One: Standard startup mode
Standard is the default mode each activity starts with an activity in the stack, and the same will be added.
So how many times will you have to press the back button to get back to the original interface?
II: Singletop startup mode
1. Checklist Configuration:
<activity
Android:name= "Com.itcode.taskstack.SecondActivity"
Android:label= "@string/_second"
Android:launchmode= "Singletop" >
</activity>
Singletop: If there is already an instance of this activity at the top of the stack,
Does not create new activity, but instead uses the old activity instance
Call the old activity's Onnewintent () method
2. Function:
Avoid a bad user experience, if the interface is already open and at the top of the stack of tasks, it will not be opened repeatedly
Three: Singletask startup mode:
1.Androidfest configuration:
<activity
Android:name= "Com.itcode.taskstack.SecondActivity"
Android:label= "@string/_second"
Android:launchmode= "Singletask" >
</activity>
2. Function:
Singletask startup mode: Only one instance is allowed to exist in the task stack, if 02 is Singletask,
Stack: 01 02 01 03 If you turn on 02 at this point, the existing activity is reused and the other activity above the current activity is emptied from the task stack!
3. Application Scenario:
Browser: The underlying use of the WebKit C kernel, initialization needs to request a lot of memory resources, CPU time
So use Singletask to ensure that only one instance exists in the task stack.
Four: SingleInstance startup mode (equivalent to instance):
Configuration of 1.Androidfest:
<activity
Android:name= "Com.itcode.taskstack.SecondActivity"
Android:label= "@string/_second"
Android:launchmode= "SingleInstance" >
</activity>
2. Features:
SingleInstance's boot mode is more extreme,
Start a new activity and create a separate task stack for yourself
3. Application Scenario:
There will only be one instance of the activity in the entire mobile operating system,
So multiple applications share this activity instance, thread security issues!
Activity four startup Modes 2