[Apidemos for Android samples video series] app-activity-reorder activities

Source: Internet
Author: User

1. Demo description and demonstration

This demo mainly demonstrates the use of flag_activity_reorder_to_front.


As follows:


2. Video description
Http://www.eyeandroid.com/thread-10717-1-1.html

3. Demo Analysis

The Reorder activities example has four related activitives: reorderonlaunch, reordertwo, reorderthree, and reorderfour. Reorderonlaunch is the main activity, reorderonlaunch starts reordertwo, reordertwo starts reorderthree, and reorderthree starts reorderfour. In this case, the "back stack" Status of the activity is as follows:

 

Reorderfour wants to start reordertwo again. At this time, two implementation methods are used. One is to start a new reordertwo on 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 for this intent.For exampleFlag_activity_new_task, flag_activity_clear_top, flag_activity_single_top. In these cases, Android determines how to start recordtwo Based on Different flag settings. The following example describes how to start recordtwo.

In the reorder activities example, the reordertwo in "Back stack" is moved to the top of the stack by setting intent. flag_activity_reorder_to_front when intent is started. If flag_activity_reorder_to_front is set, the activity specified in "Back stack" is moved to the top of the stack.

 
  1. Intent intent = new intent (reorderfour. This, reordertwo. Class );
  2. Intent. addflags (intent. flag_activity_reorder_to_front );
  3. Startactivity (intent );

 

The stack is shown in:

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.