When I assign the android:onclick in XML to the function, I get this error:
Error: Could not find method SubmitRegister(View) in a parent or ancestor Context for android:onClick attribute defined on view class
I checked my XML to see if there is a difference between the names, but I can assure that the function name has been spelled right.
Function in MainActivity.java:
public void SubmitRegister(View v) {
Log.d("MyApp", "Register button clicked.");
}
XML Content_main.XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Registreren"
android:id="@+id/buttonRegister"
android:layout_below="@+id/inputpassword2"
android:onClick="SubmitRegister"
android:layout_marginTop="40dp"
android:layout_alignEnd="@+id/inputpassword2"
android:layout_alignStart="@+id/inputpassword2"
android:enabled="true" />