Android jumps to another interface, which is the app's usual operation. We can jump to the interface of the application itself, and also jump to the application interface of the system.
Effect:
To open the software:
Jump to the second interface:
Jump to the interface of the system application:
The accompanying code is as follows:
Main interface Code:
1 Packagecom.yy.twoactivity;2 3 Importandroid.app.Activity;4 Importandroid.content.Intent;5 ImportAndroid.os.Bundle;6 ImportAndroid.view.View;7 8 Public classMainactivityextendsActivity {9 Ten @Override One protected voidonCreate (Bundle savedinstancestate) { A Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.activity_main); - } the - /** - * Click the event to jump to the second screen when the user clicks - * @paramView + */ - Public voidClick (View view) { + //Intentions AIntent intent=NewIntent (); at //setting up packages and Interfaces -Intent.setclassname ( This, "Com.yy.twoactivity.SecondActivity"); - //jump to the new set-up interface - startactivity (intent); - } - in /** - * Click events to activate the system's application interface to * @paramView + */ - Public voidClick2 (view view) { the //Intentions *Intent intent=NewIntent (); $ //set up packages and interfaces for pre-open system appsPanax Notoginseng //Cmp=com.android.gallery/com.android.camera.gallerypicker -Intent.setclassname ("Com.android.gallery", "Com.android.camera.GalleryPicker"); the //jump to the new set-up interface + startactivity (intent); A } the}
Create a second activity:
1 Packagecom.yy.twoactivity;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 6 Public classSecondactivityextendsActivity {7 @Override8 protected voidonCreate (Bundle savedinstancestate) {9 Super. OnCreate (savedinstancestate);Ten Setcontentview (r.layout.activity2); One } A}
Attention:
The activity information must be configured in the Androidmanifest.xml file
1<Application2Android:allowbackup= "true"3android:icon= "@drawable/ic_launcher"4Android:label= "@string/app_name"5Android:theme= "@style/apptheme" >6<Activity7Android:name= ". Mainactivity "8Android:label= "@string/app_name" >9<intent-filter>Ten<action android:name= "Android.intent.action.MAIN"/> One A<category android:name= "Android.intent.category.LAUNCHER"/> -</intent-filter> -</activity> the<Activity -Android:name= ". Secondactivity " -Android:label= "@string/app_second_name" > -</activity> +</application>
Android explicitly activates another activity