Can an activity be killed with just onPause?

时间秒杀一切 提交于 2019-12-04 15:48:59

There is no guarantee that onStop or onDestroy will be called. In situations when memory is severely lacking, the partially visible and out-of-focus Activity may be destroyed to reclaim resources. However, there is no guarantee that either of the two mentioned lifecycle methods will be called before doing so. This is why it is important to save persistent state in onPause instead of onStop and onDestroy.

Refering to activity lifecycle - if activity is killed by system, it can be killed silently in Pause state within calling onStop or onDestroy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!