Suppose you define android:onClick="doClick" in your Activity as
protected void doClick(View view) { }
The documentation states that
This name must correspond to a public method that takes exactly one parameter of type View.
This is a given requirement of the underlying Class.getMethod() method, which only finds public methods as the documentation states that it
Returns a
Methodobject that reflects the specified public member method of the class or interface represented by thisClassobject.
So how is it possible, that this implementation, which should not work at all, works on some devices and emulators, while it doesn't work on others using the same API levels as well?
from Why does a protected android:onClick method in Activity actually work?
No comments:
Post a Comment