I have implemented a progress bar within my activity XML layout but when i attempt to cast it within my activity class I receive the following error.
inconvertible types; cannot cast android.view.View com.project.Progress bar
I have researched this error but i am still unsure how to remedy it.
public class ProgressBar extends Activity{
ProgressBar progressbar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_progress_bar);
progressbar = (ProgressBar) findViewById(R.id.progressBar);
}
}
activity_progress_bar.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res /android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="91dp"
android:minHeight="60dp"
android:minWidth="220dp" />
</RelativeLayout>