Android Activity Task Stack

Source: Internet
Author: User

After knowing the basic activity life cycle, we are able to do a good job of doing business on an activity. But this is not enough, because Android through the task stack to save the entire app activity, reasonable scheduling task stack to provide a good user experience. And the structure of the stack, I believe we all know-advanced after the linear table, the new activity will be located on the stack top of the task stack, in the active state, the other activity is not active, but still remain in the task stack, in the state of being stopped (that is, OnStop is triggered, But Ondestory is not triggered).

In general, the return key and the call to finish method will remove the activity at the top, and then let the subsequent activities resume, but that is generally the case. The properties under the Androidmainfest.xml file Android:launchmode or intent flag can break this state.

The following will first introduce the Androidmainifest startup mode

    • Standard
    • Singletop
    • Singletask
    • SingleInstance

1. Standard

The default startup mode, if you do not specify the activity's startup mode, use this mode to start the activity, in which case a new instance is created each time the boot is started. Once created, the activity will be covered by the original activity. The state of the stack in this startup mode is shown:

  

2.singleTop

If you specify start activity as Singletop mode, the start will determine whether the current stack top is the activity to start, if not create a new activity instead of directly referencing the activity, if not create a new activity, This pattern usually applies to the interface that is displayed after receiving the message.

Android Activity Task Stack

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.