Interface jump means to jump to the second interface or APP when you click on the controls of the first interface. The most important command used here is Intent.
1 Start Internal the Activity:
Andrews development can not be instantiated directly Activity, need to use time as a messenger to interact Intent:
New Open Intent disposed Write the Activity
Intent Intent = new new Intent (the this, Target.class);
A at
the Android sends a request:
start Activity(intent);
A simple jump cannot support the action response of the second interface. At this time, you need to add additional messages when making the request. For example:
add at A above:
intent.putExtra(KEY,message);
Take it out when the second Activity starts KEY value:
Intent intent = getIntent();
String message = intent.getStringExtra(FirstActivity.KEY);
//Perform the setting of Layout in the second Activity, such as:
textView.setText(message);
2 Start an external activity:
TASK: To complete a complex task, a series of activities that are started continuously form a TASK, and the activity in the TASK can be returned by pressing the back key.
For example:
use new Intent(Intent.ACTION_SEND) to replace new Intent(this,Target.class);
intent.setType("text/plain");
In addition, you can attach more information.
When launching other apps, Android will traverse the AndroidManifest.xml of all apps and check whether the intent-filter element of each Activity can handle ACTION_SEND. If there are multiple
apps that can start related actions, you need to add code to select: String chooserTitle = getString(R.string.chooser);
//Return the
intent selected by the user to Intent chosenIntent = intent.createChooser(intent,chooserTitle);
startActivity(chosenIntent);
Reference materials:
https://www.icourse163.org/learn/BFU-1205989803?tid=1450759471&from=study#/learn/content MOOC course on mobile development technology