Despite the fact that the onButtonHomeClick method is declared in the Java MainActivity file, when I try to reference this method in XML, I get an error: "The onButtonHomeClick method in MainActivity has an incorrect signature." Both of them are lower, and for my life I canβt understand why it returns such an error, especially since, trying to go to the declaration, pressing Ctrl, clicking on the ButtonHomeClick in the XML file, it will switch to the Java class method. <w> And he is definitely trying to find this method, since Android Monitor returns a fatal error when trying to assign button behavior.
<item android:id="@+id/button_home" android:orderInCategory="100" android:icon="@drawable/home" android:title="Home" android:onClick="onButtonHomeClick" app:showAsAction="always" /> //Java method public void onButtonHomeClick(View v){ Intent intent = new Intent(this, MainActivity.class); }
source share