When the application runs, a thread is enabled, and a job stack is run in the thread.ActivityAfter the instance is created, it is placed in the task stack.Activity startupThe mode is set inAndroidmanifest.XMLFile, through the configurationActivityAttributesAndroid: launchmode=""Set.
1.StandaredMode (default)
We usually createActivityAll in this modeActivityIn this modeActivityFeatures: as long as you createActivityInstance.ActivityWill add the newly created instance to the task stack and exitActivityThe instance is destroyed in the task stack.
2.SingletopMode
This mode will considerActivityWhether the instance is at the top of the stack in the task stack. If the instance is at the top of the stack, you do not need to create a new instance, and the existing instance will be reused. Otherwise, a new instance will be created in the task stack.
3.SingletaskMode
If this mode exists in the task stackActivityInstanceActivityRemove all instances.Newinstance ()Method ReuseActivityTo place the instance at the top of the stack. Otherwise, a newActivityInstance.
4.SingleinstanceMode
when the mode is activity after an instance is created in the task stack, as long as the instance is still in the task stack, that is, as long as the activated instance is of this type activity , all newinstance () Method reuse activity in this case, the same activity instance , all of which are at the top of the stack. This mode is generally used for loading slow, performance-consuming, and does not need to be re-created each time activity .