Startup mode for Android activity

Source: Internet
Author: User

There are 4 modes of startup, namely:
1.standard (default)--standard
2.singleTop--Single Top
3.singleTask--Single task
4.singleInstance:---singleton--If the mainactivity instance is created in the task stack of application 1, if Application 2 also activates mainactivity, then no need to create, two apps to share the activity instance. (Single case)

This startup mode is special, it enables a new stack structure, places the acitvity in the new stack structure, and guarantees that no other activity instances will enter. The stack structure ID is displayed by This.gettaskid ().

The Android:launchmode attribute in Androidmanifest.xml configuration <activity> is one of the above four.

Activity_launchmode_singleinstance

Secondactivity and fourthactivity are singleinstance modes, others are standard mode.

Back:

Fifthactivity (5), thirdactivity (3)->firstaty (1)->fourthactivity (4), secondactivity (2)

Conclusion:

SingleInstance will create a new return stack on its own.

For the rest, see:

Http://www.cnblogs.com/fanchangfa/archive/2012/08/25/2657012.html

Application Scenarios:

http://blog.csdn.net/berber78/article/details/19628153

Http://www.tuicool.com/articles/iIf6BbV

Startup mode for Android activity

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.