General monitoring Onclicklistener Events, we are all through button button = (button) Findviewbyid (...);
Button.setoclicklisener .... This way to achieve.
This period of time to see the big open platform of the demo, found in fact can be in the XML definition of the method name, in the activity to implement the method can be.
<button
Android:layout_ Width= "70DP"
android:layout_height= "wrap_content"
android:layout_centervertical= "true"
& nbsp android:background= "@drawable/title_btn_back"
Android:o nclick= "Share_activity_back"
android:text= "Back"
android:textcolor= "#fff"
an Droid:textsize= "14sp"/>
public void Share_activity_back (View v) {
Intent Intent = new Intent ( this, mainactivity.class);
StartActivity (intent);
}
to implement the method directly in the activity. There is no need to define a button, instantiate it, with a lot of the original one for example.
Implement the OnClick event correlation processing method in the Android development layout file