Android - what happens when the app is forcibly killed
通过android的activities-doc,据说不能保证调用onstop()和ondestroy()方法。
[...] once the activity is created, onPause() is the last method that's guaranteed to be called before the process can be killed—if the system must recover memory in an emergency, then onStop() and onDestroy() might not be called [...]
我想知道,当这种情况发生时,应用程序是在活动中被杀死,还是只是活动本身被杀死?
答案是应用程序进程也会被杀死,可以重新创建。https://developer.android.com/training/basics/activity-lifecycle/recreating.html请查看http://www.vogella.com/tutorials/androidlifecycle/article.html只有停止的活动且没有服务或执行接收器的应用程序。Android将它们保存在最近使用最少(LRU)的列表中,如果需要,则终止使用最少的列表。