Android Activity startup mode

Source: Internet
Author: User

Android Activity startup mode

In Android development, the activation mode of activity has the following four kinds

Standard

Singletask

SingleInstance

Singletop

Standard

Standard boot mode, default, each time you open the activity, a new instance will be created to add to the acitivty stack.

Singletask

There is only one instance of the activity in the same activity stack, and if there is already a stack top, it will not be created, and if there is no stack top it will stack all instances of the activity above it and place itself on top of the stack.

SingleInstance

This is a singleton case, it is not only in the current activity stack is a singleton, but also a global singleton, when the activity is marked as singleinstance, the activity was originally activated in activity stack A, when it started, Creates a new activity stack B and puts its instance in activity stack B.

Singletop

Singletop's startup mode is very similar to standard, except that in the current activity stack, if there is already an instance of the activity, and it is at the top of the stack, it will not create a new instance of the activity, but if it is no longer the top of the stack, A new instance of the activity is created and added to the top of the stack without affecting the previously created instance of the activity. If there is no instance of the activity in the current task stack, it will be created and added to the top of the stack.

Summarize

In the development process, for different activity pages, different requirements scenarios need to be considered to choose different startup modes to achieve the best user experience.

Found some cases of improper use of the task stack

In earlier versions, click on a friend circle to open 2 or more (as long as your hand is fast enough, the phone responds slowly) to the Friends Circle page.

Android Activity startup mode

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.