Four Activity modes

Source: Internet
Author: User

Four modes:

The activity mode is actually about "task" and "instantiation ".

  Instantiation Task
Standard Multiple examples The preceding and following activities are in the same task.
SingleTop Single Instance/multiple instances The preceding and following activities are in the same task.
SingleTask Singleton It is not in the same job as the previous one, but in the same job as the subsequent one (start a new job stack with this root)
SingleInstance Singleton Not in the same job as others (not in the same job stack as others)

1. standard: standard mode: the same activity that is instantiated multiple times can be on the same task stack (for example, ABABAAB). Purpose: Most

2. singleTop: Single-top mode: instantiated once at the top of the stack (for example, ABABAB ). purpose?

3. singleTask: single-task mode: starts a new job stack and uses this as the root. (For example, CA and BACA [B is a single task]). purpose: to use a single task (or to prevent page refresh and optimize memory), you also need a single task (for example, startActivtyForResult is used ),

4. singleInstance: A Job stack, an isolated island. (AC, B, AC [B is a Singleton]). purpose: for example, if you want to enable an activity for ten activty stacks. the standard is too performance-consuming. single top, not used, single task (for example, ABCD, B is an activity, AC wants to enable acitivity of B), if A first enable B, B then enable D, C has enabled B and wants to enable E. see figure. I think we should use the singleton at this time.

PS: The Singleton mode and the singletaskmode are both one instance. It is usually used when the construction cost is large but the switching cost is small. Is the construction cost high? It is to do a lot of work during construction!

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.