Android: intent flags

Source: Internet
Author: User

I. Relationship between activity and task (stack)
Task is like a container, and activity is equivalent to filling in the container. The first thing (activity) will be at the bottom, and the last added thing (activity) it will be at the lowest end. Retrieving an activity from a task is taken from the top, that is, the last added activity is retrieved first, and so on. The last added activity is retrieved, the sequence of the activity in the task can be controlled, so intent flag is used in the activity jump.
2. Intent is used for page Jump and service start. Intent flag is about activity jump.
Intent intent = new intent (this, XXX. Class );
// If the activity exists in the task, it gets to the top and does not start a new activity.
Intent. addflags (intent. flag_activity_brought_to_front );
// If the activity exists in the task, terminate all the activities on the activity.
Intent. addflags (intent. flag_activity_clear_top );
// The default redirect type. Place the activity in a new task.
Intent. addflags (intent. flag_activity_new_task );
// If the activity has been run to a task, the activity will not be running again
Intent. addflags (intent. flag_activity_single_top );

Related Article

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.