Activity生命周期变化

情景一:MainActivity 启动 Main2Activity(是透明的),Main2Activity启动Main3Activity

生命周期变化如下
System.out: ====MainActivity===onCreate
System.out: ====MainActivity===onStart
System.out: ====MainActivity===onResume
System.out: ====MainActivity===onPause
System.out: ====Main2Activity===onCreate
System.out: ====Main2Activity===onStart
System.out: ====Main2Activity===onResume
System.out: ====Main2Activity===onPause
System.out: ====MainActivity===onStop
System.out: ====Main3Activity===onCreate
System.out: ====Main3Activity===onStart
System.out: ====Main3Activity===onResume
System.out: ====Main2Activity===onStop

情景二:
基于情景一,在Main3Activity按下back键

生命周期变化如下
System.out: ====Main3Activity===onPause
System.out: ====MainActivity===onRestart
System.out: ====MainActivity===onStart
System.out: ====Main2Activity===onRestart
System.out: ====Main2Activity===onStart
System.out: ====Main2Activity===onResume
System.out: ====Main3Activity===onStop
System.out: ====Main3Activity===onDestroy

情景三
基于场景二,在Main2Activity按下back键

System.out: ====Main2Activity===onPause
System.out: ====MainActivity===onResume
System.out: ====Main2Activity===onStop
System.out: ====Main2Activity===onDestroy

你可能感兴趣的:(Activity生命周期变化)