Android task and rollback stack-clear rollback Stack

Source: Internet
Author: User

If you leave a task for a long time, the system will clear all activities other than the root activity of the task. When the user returns this task again, only the root activity is stored. This method of system behavior is because after a long time, the user may have abandoned their jobs before returning the task, and started some new tasks.

You can use some activity attributes to modify this behavior:

1. alwaysretaintaskstate

If this attribute is set to "true" in the Root Activity of a task, the default behavior as described above will not happen. Even after a long time, this task retains all the activities in its stack.

2. cleartaskonlaunch

If this attribute is set to "true" in the Root Activity of a task, the stack will be cleared to the root activity no matter when the user leaves and returns the task. In other words, it is opposite to the alwaysretaintaskstate attribute. The user always returns to the initial state of the task, even if only the task is left for a while.

3. finishontasklaunch

This attribute is a bit like the cleartaskonlaunch attribute, but it only operates on a single activity, not the entire task. It can also cause any activity to exit, including the root activity. When this attribute is set to "true", the activity only maintains the part of the current session of the task. If the user leaves and then returns this task, it will no longer exist.

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.