Hi I am getting this message android.widget.imagebutton cannot be cast to android.widget.button (See attachment pic for logcat error) which I don't understand why? because my code seems to be right.
Code:
ImageButton Calendar = (ImageButton) findViewById (R.id.Calendar);
Calendar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent OpenCalendarbtn = new Intent (Menu.this, DisplayCalendar.class);
startActivity (OpenCalendarbtn);
}
});

Complete Layout xml file:
`
<ImageButton
android:id="@+id/Read"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/Write"
android:layout_marginRight="31dp"
android:src="@drawable/read" />
<ImageView
android:id="@+id/AppLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/logo" />
<ImageButton
android:id="@+id/Write"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/AppLogo"
android:layout_marginLeft="35dp"
android:layout_marginTop="14dp"
android:src="@drawable/write" />
<ImageButton
android:id="@+id/Calendar"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignLeft="@+id/Write"
android:layout_below="@+id/Write"
android:layout_marginTop="20dp"
android:src="@drawable/calendar/>
`