After the application’s resident memory in the background is preempted by other applications, the user clicks on the application and restores it to the foreground. Has the Activity stack been saved and restored, and is the Life cycle normal?

  android, question

Describe the situation as the title says, the problem is:
1. Has the sequence of activities been saved and restored, in other words, is the sequence of activities before clicking the back key normal?

2. What is the Life cycle of the last activity triggered after clicking the return key, and what is the difference from normal jump return?

3. Can you judge whether the important status is lost? Is this state stored on the hard disk and will never be lost? If there is no guarantee, then how to realize the overall restart of the entire application?

  1. First, the host learns the launchMode, four types. The first problem was solved.launchMode

  2. 1> onRestart() –> onStart() –> onResume()
    2 > according to Activity’s launchMode, the situation is different from Intent.setFlagsetFlag

  3. Do you want to ask how to judge if your App has been Kill?

ActivityManager am = (ActivityManager) ct.getSystemService(Context.ACTIVITY_SERVICE);
 List<RunningTaskInfo> infos = am.getRunningTasks(100);
 for (int i = 0;   i < infos.size();  I plus)
 RunningTaskInfo info = infos.get(i);
 if (info.baseActivity.getPackageName().equals(ct.getPackageName())) {
 if (info.numActivities !  = info.numRunning)
 return true;
 return false;
If the program is killed, click multi-task to select App, and still start the Search configuration in the manifest file to filter < actionsandroid: name = "Android.intent.action.main"/>.
 It is common to raise the priority level in own App memory and try to avoid being killed. I will not reply to the content. Rogues will find it by themselves and will not spread it.