Android activity startup mode, androidactivity
There are four startup modes for an activity: standard, singleTop, singleTask, and singleInstance. You can select the startup mode by specifying the android: launchMode attribute for the <activity> tag in AndroidMannifest. xml.
1. standard
It is the default startup mode of the activity. Android uses the return stack to manage the activity. In standard mode, every time a new activity is started, it will add the stack to the return stack, and at the top of the stack. The system does not care whether the activity already exists in the returned stack. A new instance of the activity will be created each time it is started.
2. singleTop
When the Startup Mode of the activity is specified as singleTop, if it is found that the stack top of the returned stack is already the activity when the activity is started, it is considered to be used directly and no new active instances will be created. It can solve the problem of repeated stack top creation activities.
3. singleTask
When the active startup mode is specified as singleTask, the system first checks whether the active instance exists in the returned stack each time it starts the activity. If the active instance exists, it is directly used, all the activities above this activity are pushed out of the stack. If no activity is found, a new activity instance is created.
4. singleInstance
The singleInstance mode should be the most special and complex of the four startup modes. Different from the above three startup modes, an activity specified as singleInstance mode enables a new return stack to manage this activity.