Android : OnClick Method Scope

on Sunday, September 7, 2014


Somehow I can see the onClick Methods from other activities in my project. I do not know why, but it seems like they are set global.


Now I have a onButtonOkClick method in my current activity and an onButtonOkClick in the previous activity and I get a NullPointerException because it tries to access the one from the previous activity.


Where can I configure that scope? Apparently the onClick methods have to be public also?



public void onButtonOkClick(View view) {
// CODE
}


I can also see all elements like EditText and Buttons from other Activities in the resources (R.id). Maybe I misconfigured this somewhere?


0 comments:

Post a Comment