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