"Sail Plan 011" 2015 sail plan Android Apidemo Devil step app->activity->reorder activities back stack Intent FLAG

Source: Internet
Author: User

The Reorder activities example has four related activitives:reorderonlaunch, Reordertwo,reorderthree, Reorderfour. Where Reorderonlaunch is the main activity,reorderonlaunch start Reordertwo, Reordertwo starts reorderthree,reorderthree. At this time, the "Back stack" of the activity has the following status:

Reorderfour want to start reordertwo again, at this time with two implementation methods, one is to start a new reordertwo above the Recordfour, which is the default behavior of StartActivity. This is because in Androidmanifest.xml:

<activity android:name= ". App. Reordertwo "/><activity android:name=". App. Reorderthree "/><activity android:name=". App. Reorderfour "/>

. App. Recordtwo does not define any flag of this intent. 比如有 Flag_activity_new_task,flag_activity_clear_top,flag_activity_single_top, in these cases Android will decide how to start the Recordtwo based on the different flag settings, as described in the following examples.

In the REORDER activities example, the Reordertwo in the back stack is moved to the top of the stack by setting Intent.flag_activity_reorder_to_front when the Intent is started. If Flag_activity_reorder_to_front is set, the ACTIVITY specified in the back stack is moved to the top of the stack.

    New Intent (Reorderfour.  this, reordertwo. class );      Intent.addflags (intent.flag_activity_reorder_to_front);      StartActivity (intent);  

The stack looks like this:

"Sail Plan 011" 2015 sail plan Android Apidemo Devil step app->activity->reorder activities back stack Intent FLAG

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.