您的位置:首页 > 移动开发 > Android开发

Android生命周期函数执行顺序

2014-09-04 22:43 316 查看
程序正常启动:onCreate()->onStart()->onResume();

onCreate之后就会执行onStart,此时画面已经显示出来了,但还不能交互;然后执行onResume,此时可以与用户交互了。

正常退出:onPause()->onStop()->onDestory()

一个Activity启动另一个Activity: onPause()->onStop(), 再返回:onRestart()->onStart()->onResume()

程序按back 退出: onPause()->onStop()->onDestory(),再进入:onCreate()->onStart()->onResume();

程序按home 退出: onPause()->onStop(),再进入:onRestart()->onStart()->onResume();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: