View xml:
android:onClick="yourMethodName"
The context in which this Viewis used is the class this method should have (usually this is yours Activity)
For instance:
<TextView
android:onClick="register"
android:layout_width="wrap_parent"
android:layout_height="wrap_parent"/>
In your context, you will need the following method (again, yours Activity):
public void register(View v) {
}
This is what you can do with any type View. Here is the link for Android .
source
share