安卓生命周期分析

场景1——Activity之间的跳转:
第一次进入MainActivity:
08-24 17:37:03.708: D/LogTag(3243): MainActivity------>onCreate()------------------>
08-24 17:37:03.732: D/LogTag(3243): MainActivity------>onStart()------------------>
08-24 17:37:03.733: D/LogTag(3243): MainActivity------>onResume()------------------>

点击跳转到MainActivity_2:
08-24 17:37:06.717: D/LogTag(3243): MainActivity------>onPause()------------------>
08-24 17:37:06.747: D/LogTag(3243): MainActivity_2------>onCreate()------------------>
08-24 17:37:06.772: D/LogTag(3243): MainActivity_2------>onStart()------------------>
08-24 17:37:06.773: D/LogTag(3243): MainActivity_2------>onResume()------------------>
08-24 17:37:07.125: D/LogTag(3243): MainActivity------>onStop()------------------>

按返回键返回到MainActivity:
08-24 17:37:10.878: D/LogTag(3243): MainActivity_2------>onPause()------------------>
08-24 17:37:10.891: D/LogTag(3243): MainActivity------>onRestart()------------------>
08-24 17:37:10.892: D/LogTag(3243): MainActivity------>onStart()------------------>
08-24 17:37:10.893: D/LogTag(3243): MainActivity------>onResume()------------------>
08-24 17:37:11.230: D/LogTag(3243): MainActivity_2------>onStop()------------------>
08-24 17:37:11.230: D/LogTag(3243): MainActivity_2------>onDestroy()------------------>

场景2——按Home键:
第一次进入MainActivity:
08-24 17:40:23.009: D/LogTag(3243): MainActivity------>onCreate()------------------>
08-24 17:40:23.065: D/LogTag(3243): MainActivity------>onStart()------------------>
08-24 17:40:23.069: D/LogTag(3243): MainActivity------>onResume()------------------>

按Home按键:
08-24 17:40:31.279: D/LogTag(3243): MainActivity------>onPause()------------------>
08-24 17:40:31.794: D/LogTag(3243): MainActivity------>onStop()------------------>

重新进入MainActivity:
08-24 17:40:36.960: D/LogTag(3243): MainActivity------>onRestart()------------------>
08-24 17:40:36.961: D/LogTag(3243): MainActivity------>onStart()------------------>
08-24 17:40:36.961: D/LogTag(3243): MainActivity------>onResume()------------------>

 

posted on 2016-08-24 17:47  leihupqrst  阅读(116)  评论(0编辑  收藏  举报

导航