My understanding of the four activity initiation modes for standard, Singletop, Singletask, and SingleInstance

Source: Internet
Author: User

Before learning about Android, the four startup modes were only initially understood in a literal way, from videos and books. Recently, the four kinds of startup modes have a clearer concept. First of all, what is activity, according to my understanding, every page we see on the phone is an activity, including the system's desktop, but also an activity. To start an activity there are four modes: standard (normal boot mode), Singletop, Singletask, SingleInstance. Note: Aty1_1 and aty2_1 are different instances of the same activity for two different activity,aty1_1 and aty1_2. 1. StandardDifferent activity in the same stack, each time a new instance is created, the new instance will be stacked to the top of the stack. When the point returns the key, the instance is removed from the top of the stack in sequence. Until the stack is empty, it is returned to the desktop. 2. SingletopThe different activity is in the same stack.        ① If the Aty1 instance is at the top of the stack at this point, then creating a new Aty1 will not succeed.        ② if Aty_1 is not at the top of the stack, then creating an instance of Aty1 will result in a new Aty1 instance to the top of the stack. When the point returns the key, the instance is removed from the top of the stack in sequence. Until the stack is empty, it is returned to the desktop. 3. SingletaskThe different activity is in the same stack.      ① If the Aty1 instance is at the top of the stack at this point, then creating a new Aty1 will not succeed.        ② if Aty_1 is not at the top of the stack and then creates an instance of Aty1, the page returns to the Aty1 instance that exists in the task stack and moves all instances above the Aty1 out of the stack. When the point returns the key, the instance is removed from the top of the stack in sequence. Until the stack is empty, it is returned to the desktop. 4. SingleInstanceDifferent activity is in different stacks ① if the Aty1 instance is at the top of the stack at this point, creating a new Aty1 will not succeed.        ② if an instance of Aty2 has not been created at this time, the instance of Aty2 created will be stored in a new task stack. ③ if an instance of Aty1 already exists and we create a new Aty1 instance in Aty2 's page, the new Aty1 instance is not created, but the page jumps to the Aty1 instance that exists in the original task stack, but the task stack that holds the Aty2 instance still exists when the point returns the key, which in turn Destroy the corresponding task stack until the number of task stacks is empty and back to the system desktop. The above is my understanding of the four activity startup modes of Android, and if there is something wrong, I would also correct.

My understanding of the four activity initiation modes for standard, Singletop, Singletask, and SingleInstance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.