Activity常规操作对应的生命周期

xiaoxiao2021-02-28  15

1. 竖屏切横屏

启动时

onCreate–onstart–onresume

切换后

onpause–onSaveInstanceState–onstop–onDestroy–onCreate–onStart–onResume

2. 切换后台(home 键切后台)

切换到后台时

onPause–onSaveInstanceState–onStop

从后台切换回来

onRestart–onStart–onResume

3. 点击 menu 键

想切换程序时但是还没切换时,已经执行方法

onPause–onSaveInstanceState–onStop

仍然选择本应用,会执行:

onRestart–onStart–onResume

4. 应用之间地切换跟 (2. 切换后台) 周期一模一样

5. 点击 menu 键,删除应用进程

onPause--onSaveInstanceState--onStop--onDestroy
转载请注明原文地址: https://www.6miu.com/read-2800231.html

最新回复(0)