"Sail Plan 007" 2015 Sail plan Android Apidemo Devil Step app->activity->forwarding activity start another activity finish () method

Source: Internet
Author: User

An Android app can contain multiple activity, and an activity can initiate another activity.

The activity is managed with a stack structure, and the newly opened activity is stacked on top of the current activity, and the current activity stops running.

When an activity stops running, the Android system retains its pre-stop state, and when the user presses the "Back" button, the top activity of the stack is rolled out of the stack and the previous activity moves to the top of the stack and is displayed on the screen:

Sometimes, when an activity launches a new activity, it does not want to keep the activity in the activity stack, such as when a confirm dialog is implemented using activity, and when the user confirms that a new activity is initiated, Do not want to display confirm Dialog when the new activity is displayed by pressing "back".

Example fowarding uses finish () to end the current activity while starting a new activity.

            // Here we start the next activity, and then call Finish ()             // So, our own would stop running             and is removed from the // History stack.            New Intent ();            Intent.setclass (Forwarding. this, forwardtarget. class );            StartActivity (intent);            Finish ();

Finish finishes forwarding Activity, and then presses "back", then directly to the Apidemo->activity sample list instead of the forwarding interface.

Sail plan 007 2015 sail plan Android Apidemo Devil Step app->activity->forwarding activity start another activity finish () method

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.