"Android first line code" learn to record the starting mode of 006-4 kinds of activities

Source: Internet
Author: User

First, the activity has 4 kinds of starting mode

    • Standard: For this mode of activity, the system does not care if it already exists in the return stack, and each start creates an instance of the activity
    • Singletop: If you find that the stack top of the return stack is already the activity when you start the activity, you think you can use it directly and no new instances will be created
    • Singletask: The system checks to see if an instance of the activity exists in the return stack before starting the activity, and if the discovery already exists, all the activities on top of that activity will be stacked
    • SingleInstance: The activity in this mode enables a new return stack to manage this activity, regardless of which application accesses the activity, sharing a return stack, which solves the problem of shared activity instances

Second, how to specify a different startup mode for the activity?

In Androidmanifest.xml, the activity node of the event is specified, as follows

 1  <  activity  2  android:name  = ". Activity " 3   Android:launchmode  Span style= "color: #0000ff;" >= "Singletop"  >  4  <  intent-filter  >  5  </ intent-filter  >  6  </ activity  >  

Iii. questions left to themselves

What are the 4 different boot mode activities applied to each scenario?

"Android first line code" learn to record the starting mode of 006-4 kinds of activities

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.