This is what I read from a book:
The activity can be destroyed silently after onPause(). We should never assume that either onStop() or onDestroy() is called.
But according to the documentation, Pause refers to partly visible, can an activity partly visible be killed without calling onStop or onDestory?
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
.
指活动生命周期 -如果活动被系统杀死,则可以在调用onStop或onDestroy时以暂停状态静默杀死它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.