Activity start mode differences and optimizations

Source: Internet
Author: User

Novice Android Developers may often ignore this important setting.

The activity has the following four kinds of Launchmode:
1.standard
2.singleTop
3.singleTask
4.singleInstance
We can configure <activity> the Android:launchmode attribute in Androidmanifest.xml for one of the above four kinds.

Summary description:

0 standard----standards, each time you open the same activtiy page will be a new instance of the stack innovation, the default is this


1 Singletop----If the instance object already exists in the stack, it will not be created again, just open the same activity for the current event
If another page opens, the activity will still create the object on the stack (whether it is on top of the stack)

2 Singletast---The entire application creates only one instance, if it is already in the stack, it will be closed first, always at the top of the stack.


3 SingleInstance---The entire application creates only one instance, except that the activity opened above it is placed in a new task alone
That cannot be shared with his own task

This mode is typically used to load slower, less expensive activity that does not need to be recreated every time.

Activity start mode differences and optimizations

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.