"Goose Factory Practice Diary (0)" Activity four kinds of launchmode

Source: Internet
Author: User

1.Standard

Default mode, multiple instantiation, sequentially into the stack out of the stack.

2.SingleTop

Stack top activity is not created repeatedly, triggering the onnewintent () event, which can be instantiated more than once at the top of the stack.

3.SingleTask

Developer.android.com's argument:

(1) Create a new task, creating an activity;

(2) If there is a different task that contains an instance of the activity , it will switch to this task, which pops up the activity above the activity, and triggering the Onnewintent event of the activity;

(2) Describes a situation where a task is not created , but:

Experimental findings (2) of the prerequisites, a little bit of a problem:

(1) "an instance containing this activity" is not a requirement:

If no task contains an instance of the activity, there is a task that contains other activity that is part of the same app as the activity instance, instead of creating a new task, switch to the task and create a new activity in the task.

(2) "Different tasks" is not a requirement:

If there is not a different task that contains an instance of the activity, but the activity instance itself exists in the current task , it does not create a new task , and in the current task, the activity above activity pops up and triggers the activity's Onnewintent event;

4.SingleInstance

(1) If no task contains an instance of the activity, a new task is created to create an activity;

(2) If there is a task that contains an instance of the activity, it switches to the task and triggers the activity's Onnewintent event, which is the activity's exclusive task. There is no need to describe other activity that pops up.

(3) In the task containing this activity, only one activity is included, and if a new activity needs to be opened, it must be opened in another task, if the new task,task root activity is the newly opened activity, When this activity is opened, no new activity is created, only the task is brought to the foreground.

"Goose Factory Practice Diary (0)" Activity four kinds of launchmode

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.