Skip to content Skip to sidebar Skip to footer

Nullpointerexception In Setonclicklistener

This is really frustrating me and none of the other questions solved my problem. I'm using a test app from a book, and copied all the code verbatim. Everything was running fine ea

Solution 1:

The problem is you're mixing up the name of the Button.

Java:

ViewaboutButton= findViewById(R.id.main_about_button);

XML:

android:id="@+id/about_button"

Either change the second to @+id/main_about_button or the first to R.id.about_button and you should be good to go.

Post a Comment for "Nullpointerexception In Setonclicklistener"