What are the startup modes of activity?

Source: Internet
Author: User

Activity startup mode setting: <activity Android: Name =". Mainactivity"Android: launchmode ="Standard"/>Four startup modes of activity:1.In standard mode, an activity is created every time an activity is activated and placed in the task stack.2.Singletop: if an instance of the activity exists at the top of the stack of the task, the instance will be reused, otherwise, a new instance will be created and placed on the top of the stack (even if the activity instance already exists in the stack, the instance will be created as long as it is not on the top of the stack ).3.If a singletask has an instance of the activity in the stack, it will reuse the instance (onnewintent () of the instance will be called ()). When it is reused, the instance will be sent back to the top of the stack, so the instance on it will be removed from the stack. If this instance does not exist in the stack, a new instance is created and put into the stack.4.Singleinstance creates the activity instance in a new stack and allows multiple applications to share and modify the activity instance in the stack. Once an instance of a modified activity exists in a stack, any application that activates or changes the activity will reuse the instance in the stack. The effect is that multiple applications share one application, no matter who activates the activity, it will enter the same application.

The first entry is used by default:Standard

What are the startup modes of 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.