Android Activity startup mode
In Android development, the activation mode of activity has the following four kinds
Standard
Singletask
SingleInstance
Singletop
Standard
Standard boot mode, default, each time you open the activity, a new instance will be created to add to the acitivty stack.
Singletask
There is only one instance of the activity in the same activity stack, and if there is already a stack top, it will not be created, and if there is no stack top it will stack all instances of the activity above it and place itself on top of the stack.
SingleInstance
This is a singleton case, it is not only in the current activity stack is a singleton, but also a global singleton, when the activity is marked as singleinstance, the activity was originally activated in activity stack A, when it started, Creates a new activity stack B and puts its instance in activity stack B.
Singletop
Singletop's startup mode is very similar to standard, except that in the current activity stack, if there is already an instance of the activity, and it is at the top of the stack, it will not create a new instance of the activity, but if it is no longer the top of the stack, A new instance of the activity is created and added to the top of the stack without affecting the previously created instance of the activity. If there is no instance of the activity in the current task stack, it will be created and added to the top of the stack.
Summarize
In the development process, for different activity pages, different requirements scenarios need to be considered to choose different startup modes to achieve the best user experience.
Found some cases of improper use of the task stack
In earlier versions, click on a friend circle to open 2 or more (as long as your hand is fast enough, the phone responds slowly) to the Friends Circle page.
Android Activity startup mode