Open the hierarchical comparison Activity and return to the App homepage, activityapp

Source: Internet
Author: User

Open the hierarchical comparison Activity and return to the App homepage, activityapp

When using another app, when we click a message from the notification bar, the corresponding message list page is displayed; of course, this operation must be a small case. The key point is that when we press the return key, we will continue to open a new page (Activity) instead of directly returning to our mobile desktop; always press the return key to return to the home page of the app (that is, the page on which the app is started from the desktop), and click return again to return to the user's desktop. :

Implement the above functions:

InActivity provides us withStartActivities () function. Yes, this is the method for opening multiple activities at a time.
Usage:

Intent [] intents = new Intent [3]; intents [0] = new Intent (this, AActivity. class); intents [1] = new Intent (this, BActivity. class); intents [2] = new Intent (this, CActivity. class); // return the order of opening the page in the descending order of the array startActivities (intents );
Activity lifecycle:

First, opening will open the last one in the arrayExecute Activity simultaneouslyOnCreate->OnStart->OnResume lifecycle;

At this time, other activities are not started. When you press the return key, they are created in sequence.Activity, of course, the previousThe Activity is executed.onDestroy

Complete lifecycle Diagram


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.