activity startup mode . Concept Activity startup mode defines the rules for activity initiation, which determines whether an activity's instance is created or reused . Properties The Activity's startup mode is set in the <activity> tab in Menifest.xml, and the property is Launchmode . Classification the activation mode of activity is divided into four categories: standard, Singletop, Singletask, singleinstance . Remarks Android uses task to manage different activity. When an activity is started, the system creates a task before starting the activity the entrance. We can understand the task as a stack. . Standard (normal mode) settings: System default mode, not set feature: Each time you create an activity, a new activity object will be created and pinnedExample: Jump from activity A to activity B, then jump to Acticitya, the stack is: A, B , a . Singletop (stack top singleton mode) setting: Launchmode = "Singletop" Features: Check whether the top element of the stack is the current activity, if it is, reuse it, or, if not, create a new activity, pinnedExample: The current stack is: A, B, C, the current stack top is C, if jump to C, then the C, the stack is: A, B, C . Singletask (full stack singleton mode) setting: Launchmode = "Singletask"Features: Check whether the full stack element has the current activity, if any, so that the activity above the activity out of the stack, so that it is pinnedExample: The current stack is: A, B, C, D, if jump to B, then C, d out of the stack, the stack is: a-b . SingleInstance (System singleton mode) setting: Launchmode = "SingleInstance" Features: System-wide checks for the presence of the activity and, if present, multiplexing from the above summary same point: target activity must be pinned different points: standard creates a new activity instance each time Singletop/singletask first checks for the presence of the activity, and the presence is reused. Singletop due to the top operation of the stack, do not need to be pinned; Singletask must be pinned Singletop/singletask are implemented in-stack singleton SingleInstance is the implementation of the system single case singletask/singletop mode, all calls to Onnewintent ()
Androidのactivity startup mode