The android boot mode is the operating mode of the activity task stack: The task stack is used to store activity
The Android:launchmode property of the label in the Androidmanifest.xml setting Activiy the startup mode, the default startup mode is standard;
Activity has four kinds of start-up modes: Standard, Singletop, Singletask, singleinstance, respectively;
Task stack:
Each application has a task stack, which is a stack of functions similar to that of a function call, and the order represents the order in which the activity appears; For example, Activity1-->activity2-->activity3, the task stack is:
Now let's talk about his startup mode:
First, Standard
(1) Standard: Every time the activity is activated (startactivity), the activity instance is created and put into the task stack;
(2) Singletop: If an activity itself activates itself, that is, the task stack top is the activity, you do not need to create, the rest of the case to create activity instances;
(3) Singletask: If the activity to be activated in the task stack exists in the instance, you do not need to create, just need to put this activity into the top of the stack, and the activity of the activity above the instance of pop;
(4) SingleInstance: If Mainactivity instance is created in the task stack of application 1, if Application 2 also activates mainactivity, then no need to create, two apps to share the activity instance;
Application of Singtask:
can be used to exit the entire application.
Set the main activity to Singtask mode, then transfer the activity to the main activity in order to exit, then rewrite the onnewintent function of the main activity and add a finish to the function.
Android Activity Startup mode