The errors says that im trying to cast a TextView into a Button, but I dont see anything wrong with my code
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:background="@drawable/bg_grass"
tools:context=".Game3Activity" >
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/junk"
android:src="@drawable/bg_woodslab" />
<ImageView
android:id="@+id/game3_q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/junk"
android:src="@drawable/btn_picturehole" />
<TextView
android:id="@+id/game3_q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/imageView3"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_wordhole"
android:gravity="center"
android:textSize="20sp" />
<Button
android:id="@+id/game3_choice2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="74dp"
android:contentDescription="@string/junk"/>
<Button
android:id="@+id/game3_choice1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/game3_choice2"
android:layout_alignBottom="@id/game3_choice2"
android:layout_toLeftOf="@id/game3_choice2"
android:contentDescription="@string/junk"/>
<Button
android:id="@+id/game3_choice3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/game3_choice2"
android:layout_alignBottom="@id/game3_choice2"
android:layout_toRightOf="@id/game3_choice2"
android:contentDescription="@string/junk"/>
Java onCreate function:
image = (ImageView)findViewById(R.id.game3_q1);
textview = (TextView)findViewById(R.id.game3_q2);
Variables were already initialized as private variables (private ImageView image)etc The app immediately crashes after I try to set the imageview. Any solutions?