Proper way to implement Android XML onClick attribute in Activity
- by Austyn Mahoney
I have used the android:onClick attribute extensively in my XML layouts for my Android application.
Example:
<Button
android:id="@+id/exampleButton"
android:onClick="onButtonClick" />
Is it proper to create an Interface to enforce the implementation of those onClick methods in Activities that use that layout file?
public interface MyButtonInterface {
public onButtonClick(View v);
}