Progress bar inconvertable types; cannot cast error

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>


ANSWERS:


Your class has the same name as the widget ProgressBar. It is trying to cast View object to your class not to android.widget.ProgressBar

Either change the name of your class or provide full package name.



 MORE:


 ? Remove progress bar from published document in MATLAB
 ? What is the basic idea behind programming a progress/status bar in MATLAB?
 ? Text progress bar in Matlab
 ? MATLAB update waitbar
 ? xlsread and waitbar MATLAB
 ? How to modify xlsread to get a step-by-step updated flag from loading process
 ? How can I make waitbar in MATLAB modal
 ? Get waitbar value in Matlab
 ? waitbar matlab before start a standalone script
 ? matlab progress bar not depanding on time