I understand four Activity startup modes: standard, singleTop, singleTask, and singleInstance. activitysingletop
When I learned about android, I only had a literal understanding of the four startup modes from videos and books. Recently, the four startup modes have been clearly defined. First, let's talk about what Activity is. According to my understanding, every page we see on our mobile phone is an Activity, including the desktop of the system and an Activity. There are four modes to start an Activity: standard, singleTop, singleTask, and singleInstance. Note: Aty1_1 and Aty2_1 are two different activities. Aty1_1 and Aty1_2 are different instances in the same Activity.1. standardDifferent activities are in the same stack. Each time a new instance is created, the new instance is stacked to the top of the stack. When the return key is clicked, the instance is removed from the stack top in order. If the stack is empty, it is returned to the desktop.2. singleTopDifferent activities are in the same stack. ① If the Aty1 instance is at the top of the stack, creating a new Aty1 instance will not succeed. ② If Aty_1 is not at the top of the stack, a new Aty1 instance will be created to the top of the stack. When the return key is clicked, the instance is removed from the stack top in order. If the stack is empty, it is returned to the desktop.3. singleTaskDifferent activities are in the same stack. ① If the Aty1 instance is at the top of the stack, creating a new Aty1 instance will not succeed. ② If Aty_1 is not at the top of the stack, then create an Aty1 instance. The page will return to the Aty1 instance in the task stack, and remove all the instances above Aty1 from the stack. When the return key is clicked, the instance is removed from the stack top in order. If the stack is empty, it is returned to the desktop.4. singleInstanceDifferent activities are in different stacks. ① if the Aty1 instance is at the top of the stack, creating a new Aty1 instance will not succeed. ② If the Aty2 instance has not been created yet, the created Aty2 instance will be stored in a new task stack. ③ If the Aty1 instance already exists and we create a new Aty1 instance on the Aty2 page, no new Aty1 instance will be created, instead, the page jumps to the Aty1 instance in the original Task Stack, but the task stack storing the Aty2 instance still exists. When the return key is clicked, the corresponding task stack will be destroyed in sequence, if the number of task Stacks is empty, the system desktop is returned. The above is my understanding of the four Android Activity startup modes. If there is something wrong, I still hope to correct it.