Android Technology 7:activity Start-up mode

Source: Internet
Author: User

1.Activity Boot Mode

The four startup modes of activity in the Android system

    • Standard (default)
    • Singletop
    • Singletask
    • SingleInstance

The four startup modes are configured in Androidmanifest.xml for each activity in the parameter settings Android:launchmode

2. Pattern Features

Standard: In this mode, a new instance is generated each time it is started by using intent. Android:launchmode is not configured, the default is standard.

Singletop: This mode is similar to standard, except that if the current activity is at the top of the stack, when intent launches the activity, no new instances are generated and the original instance is reused. However, if the activity is not currently at the top of the stack, a new instance is regenerated. If the intent parameter flag_activity_new_task is specified, it will be restarted to another task.

Singletask: In this mode, activity will only have one instance. If an instance of the activity already exists in a task, the new one is no longer started and is reused every time, and reuse is if the activity is at the bottom of the task's stack and will be transferred to the top of the stack.

SingleInstance: The only difference between this pattern and singletask is that, in this mode, the activity will own a task independently, not be shared with other activity, each activity is reused, and there can be only one instance of the global.

3. Example Demo

Related Article

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.