Then android-activity use (1) to achieve page jump
One. Add a button to the main_activity, note that the ID is written as "@+id/" + "ID real name"
<Button android:layout_width="Wrap_content " android:layout_height= "wrap_content" Android:text=start_aty1 " Android:id=" @+id/btnstartaty1 " Android:layout_below= "@+id/tvout" Android : Layout_alignparentstart= "true
Two. Implementing a jump in Mainactivity.java
PrivateButton btnSatrtAty1; @Overrideprotected voidonCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); //must be placed after the Setcontentview .btnsatrtaty1=(Button) Findviewbyid (r.id.btnstartaty1); //set the event listener for the buttonBtnsatrtaty1.setonclicklistener (//an anonymous class that implements the Onclicklistener interface NewView.onclicklistener () {@Override Public voidOnClick (view view) {//event to start the Aty1//parameter One: examples of mainactivity//parameter two: The class of the activity to be started is defined as type class//This refers to the inner class that implements the OnclicklistenerIntent i=NewIntent (mainactivity. This, Aty1.class); StartActivity (i); } }); }
Third, the realization of the closure of the page
Directly call method Finish ();
Android-activity Use (2)