(Android Review) task stack and startup mode

Source: Internet
Author: User



This knowledge point is mainly based on understanding:

One, Task stack

1, the role: is used to manage the activity of entry, exit. The behavior of the user is recorded.

2. For example:

If you want to do the following:


In this case, the activity in the task stack is as follows:





Second, the starting mode

1. Configuration:

For example:

<activity
Xxxx
android:configchanges= "Orientation|keyboardhidden" >


2. Classification:

Standard: Click on an activity to create a new activity


Singletop: If the activity you want to start is already on top of the stack, then this is not a new activity


Singletask: If the activity you want to start is already in the task stack, then he will find the activity and put the activity
All of the above activity is emptied and reused for this activity.


SingleInstance: Such activity consumes a separate task stack. When you start such an activity, if you find that the task stack already has
The reference to the activity, the previous reference will be broken off


3. Examples:


Note: Use A to denote mainactivity, use B to denote main2activity

1) If you perform the operation of a---->b---->b--->a,

The results of the task stack corresponding to standard and singletop are:




2) If you perform A------>b-------->a------>b operation,

The respective task stacks for Singletask and singleinstance are as follows:












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.