Android——Activity生命周期

Android——Activity生命周期_第1张图片

启动MainActivity

MainActivity: onCreate
MainActivity: onStart
MainActivity: onResume

从MainActivity启动SecondActivity

MainActivity:  onPause//另一个Activity插入到MainActivity前面
SecondActivity: onCreate
SecondActivity: onStart
SecondActivity: onResume
MainActivity:  onSaveInstanceState
MainActivity:  onStop//MainActivity不可见

点击Home键

SecondActivity: onPause
SecondActivity: onSaveInstanceState
SecondActivity: onStop

点击图标启动

SecondActivity: onRestart
SecondActivity: onStart
SecondActivity: onResume

点击返回键

SecondActivity: onPause
MainActivity:  onRestart
MainActivity:  onStart
MainActivity:  onResume
SecondActivity: onStop
SecondActivity: onDestroy

你可能感兴趣的:(android)