"Android app development" flag used by Activity intent

Source: Internet
Author: User

Activity Intent frequently used FLAG

Intent.flag_activity_new_task

The default jump type will recreate a new activity, but in this case, for example, there are a,b,c three activity in Task1, when D is started in C, If the value added to D in the Manifest.xml file is different from the affinity in the task, the activity is pressed into the task that exists in the newly tagged affinity. If the default or specified affinity and task are the same, start a new activity just like the standard mode.

Flag_activity_single_top

This flag is equivalent to the singletop in the load mode, such as the case in the original stack is a,b,c,d D in D, the case in the stack or a,b,c,d

Flag_activity_clear_top

This flag is equivalent to the singletask in the load mode, and this flag-activated activity will pop up the stack space on the activity above the activity to be started. Class such as: The case of the original stack is a,b,c,d this time from D to B, this time the stack is the case of a, B

Flag_activity_brought_to_front

If the activity exists in a task and is started with Flag_activity_brought_to_front , it will not start a new activity until it gets to the top. Let's say I now have a, start B in a, and add this tag to the intent in a. At this time B is to flag_activity_brought_to_front this start, at this time again in B again start c,d (normal start c,d), if this time in D again start B, this time the last stack is a,c,d,b. It is particularly important to note that Do not misunderstand this: A,b,c,d are standard loading, and then I start a in D, this intent plus flag_activity_brought_to_front, will be mistaken to become b,c,d,a!! Actually not, this time should be a,b,c,d,a. You can try it if you don't believe it. This means that only the activity a in the stack is started with Flag_activity_brought_to_front, and the new activity A will not be created the second time.

Flag_activity_reorder_to_front

According to Intent.flag_activity_brought_to_front last said, if the a,b,c,d normal start, whether B is used flag_activity_brought_to_ FRONT Start, this time in D in the start of B, or will become a,c,d,b.

Flag_activity_no_history

Use this tag as the name implies! It means that with this flag activated activity, once launched, he will not exist in the stack, for example! The original is a,b,c this time again C with this flag to start D, D and then start E, this time the stack in the case of A,b,c,e.

"Android app development" flag used by Activity intent

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.