Package com. lidongbo;
Import Android. App. activity;
Import Android. OS. Bundle;
Import Android. View. view;
Import Android. widget. Button;
Import Android. widget. textview;
Public class myactivity extends baseactivity {
/** Called when the activity is first created .*/
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
Button button = (button) findviewbyid (R. Id. button01 );
Button. setonclicklistener (backonclicklistener );
}
Private button. onclicklistener backonclicklistener = new button. onclicklistener (){
Public void onclick (view v ){
Myactivity. This. setresult (result_ OK, intent );
Myactivity. This. Finish ();
}
};
}
these are the basic knowledge of Java.
first, this indicates a reference to this class.
This. * Indicates calling a method of this class. This can be omitted at this time. However, this cannot be omitted in the internal class. Otherwise, the compiler considers this as a reference of the internal class, therefore, you must add the class name
* before this *. this indicates the reference of this class. Generally, the preceding * is represented by the name of this class, which can be omitted, but the class name must be added to the internal class.
*. class indicates other classes.
intent is the most commonly used class in Android. setclass (. this, B. class);