[Apidemos for Android samples video series] app-activity-forwarding

Source: Internet
Author: User

1. Preface

The demo analysis references the mapdigit article about API demos. On the basis of this article, I further analyzed related knowledge points.

 

2. Demo

3. Demo Analysis

Android applications can contain multiple activities. One activity can start another activity. These activities are managed using the stack structure. Newly opened activities are stacked on the current activity, and the current activity stops running. When an activity stops running, the android system retains its status before it stops. When you press the "back" button, the activity at the top of the stack is pushed back from the top of the stack, the previous activity is moved to the top of the stack and displayed on the screen:

Sometimes, when an activity starts a new activity, it does not want to keep the current activity in the activity stack. For example, when the activity is used to implement a confirm dialog, when the user confirms and starts a new activity, the user does not want to display the confirm dialog when the new activity is displayed after "back.

 

In the example, fowarding uses finish () to end the current activity while starting the new activity.

 

Intent intent = new Intent();  intent.setClass(Forwarding.this, ForwardTarget.class);  startActivity(intent);  finish();  

Finish the forwarding activity, and then press "back" to return to the apidemo-> activity sample list instead of forwarding.

 

4. Video Explanation:

Http://www.eyeandroid.com/thread-9716-1-1.html

 

5. We learned the following demo:

 

1. Four methods to exit the Android Application

Http://www.eyeandroid.com/thread-9701-1-1.html

 

 

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.