This knowledge point is mainly based on understanding:
One, Task stack
1, the role: is used to manage the activity of entry, exit. The behavior of the user is recorded.
2. For example:
If you want to do the following:
In this case, the activity in the task stack is as follows:
Second, the starting mode
1. Configuration:
For example:
<activity
Xxxx
android:configchanges= "Orientation|keyboardhidden" >
2. Classification:
Standard: Click on an activity to create a new activity
Singletop: If the activity you want to start is already on top of the stack, then this is not a new activity
Singletask: If the activity you want to start is already in the task stack, then he will find the activity and put the activity
All of the above activity is emptied and reused for this activity.
SingleInstance: Such activity consumes a separate task stack. When you start such an activity, if you find that the task stack already has
The reference to the activity, the previous reference will be broken off
3. Examples:
Note: Use A to denote mainactivity, use B to denote main2activity
1) If you perform the operation of a---->b---->b--->a,
The results of the task stack corresponding to standard and singletop are:
2) If you perform A------>b-------->a------>b operation,
The respective task stacks for Singletask and singleinstance are as follows: