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