Learn two concepts first: task stack ID, activity instance ID
Setting the startup mode in Manifests->activitymanifest.xml
<activity android:name= ". Mainactivity "android:launchmode=" standard ">
Standard mode
Every time you start your own activity will start, the task stack ID one, the activity instance ID is different each time
Second, Singletop
When the activity to be started is at the top of the stack, launching itself will only create an activity instance.
A new activity instance is created when the activity to be started is not at the top of the stack
Third, Singletask
For example, starting from the Mainactivity bactivity, and then start Mainactivity, will bactivity pop-up, directly back to just the mainactivity, and then return to the point of direct exit
Iv. singleinstance
Only one instance of activity will be placed in a task stack.
"Learning Notes" Activity startup mode in Android