Android task stack and startup mode

Source: Internet
Author: User

1. An application is typically composed of multiple activity.
2. The task stack (the alias back stack) records the activity that the user has opened.
3. When an application is turned on the system assigns him a task stack, and when all activity exits, the task stack is emptied.
4. The ID of the task stack is an integer data type that is self-growing.
5. In the Android operating system there will be multiple task stacks, one application a task stack.
6. The desktop application is the same as the general application, and the task stack behaves the same.
7. By default, an application is closed and the task stack for the application is emptied. The process of the application is also preserved.

Why introduce the concept of a task stack:
You can switch tasks by clicking on the taskbar under Windows
Android under long press small House switch task

Google introduces the task stack concept to help maintain a good user experience in order to record the activity that the user has opened and to record the order in which the activity was opened.

Activation mode of activity:

Configure the specified activity in Androidmanifest.xml:

Android:launchmode= "SingleInstance"
>

1. Standard default boot mode, each time startactivity creates a new instance of activity.
Applies to a large number of cases
2. Singletop single Top, if the activity to be opened already exists at the top of the task stack, no new instance is created.
Instead, call the Onnewintent () method.
Application scenario: Browser bookmarks. Avoid top-of-the-stack activity being created repeatedly to solve user experience problems.
3. Singletask a single task stack, activity only has one instance in the task stack. If activity is to be activated, the
The task stack already exists, it does not create new activity, but instead uses the existing activity,
Call the Onnewintent () method and empty all activity on the activity task stack
Application Scenario: Browser activity, the entire task stack only one instance, saving memory and CPU purpose
Note: Activity is still running in the task stack of the current application. No new task stack is created.

4. SingleInstance single-state single-case mode
Single instance, only one instance of the entire mobile operating system exists. Different applications to open this activity
Share the same activity as the common one.
He will run in his own separate, separate task stack, and there is only one instance of him inside the task stack.
Application scenario: Call-to-phone interface Incallscreen

A companion tour, a free dating site: www.jieberu.com

Push family, free tickets, scenic spots: www.tuituizu.com

Android task stack and startup mode

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.