Activation mode of activity

Source: Internet
Author: User

    • Standard mode , a new instance is created each time an Activity is created

    • Singletop Stack top multiplexing mode , if the instance already exists on the stack top of the task stack, then the Activity is not created and its on Newinte will be recalled .

    • SIngle Task Stack mode , if the desired task stack does not exist , create a corresponding task stack, and then create the required instances to be merged into the stack, If the desired task stack exists, find the appropriate instance in the task stack, move the instance to the top of the stack if there is a corresponding instance, or create a corresponding instance to merge the stack

    • SingleInstance Single Instance mode , the enhanced version of the singleton task , Activity with this attribute can only exist in the corresponding task stack alone

  

Taskaffinity Specifies the name of the task stack , by default , the package name for the app

1. Add Luanchermode to Activity set startup mode

2. Specify the activation mode of the Activity by setting Flag to Intent

The first method cannot set the Flag_activty_clear_top identity directly to Activty , the second cannot set the singleinstance mode

Flag_activity_new_task : specifies that ACTIVITY's startup mode is singletask

Flag_activity_single_top: Specifies that ACTIVITY's startup mode is singletop

Flag_activity_clear_top: in case of Singletask, if the instance already exists , then onnewintent, if standard mode , then all the activity on top of it will be out of the stack , then create a new activity and put it into the task stack

Flag_activty_exclude_from_recents: activity with this tag does not appear in the History list of activity

matching rules for Intent

    • Action

One

    • Category

As long as there is a corresponding category, add Android by default . Intent.category.DEFAULT This category

    • Data

Consists of two parts , mimeType and URI

the default value for the URI is content or file

<scheme>://

Activation mode 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.