LiftInspection.axml
<Button
android:id="@+id/expandCollapse1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/expand_arrow"
android:text="Function/Controls"
android:textSize="20sp"
android:textColor="@android:color/white"
android:background="@drawable/expandCollapseButton"
android:gravity="center"
android:onClick="button_Click"/>
LiftInspection.cs
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.LiftInspection);
}
public void button_Click(View view)
{
Toast.MakeText(this, "Testing", ToastLength.Long).Show();
}
As soon as I click the button, the app crashes and forces close. In the Android Log, I find "java.lang.IllegalStateException: Could not find a method button_Click(View) in the activity class cpecfieldapp.LiftInspection for onClick handler on view class android.widget.Button with id'expandCollapse1'"
Everything I've found on setting up a click event from xml only shows what I'm doing. Putting it in android:onClick from XML and having a public void where the only parameter is a View in the activity implementing that layout. What am I missing?