将活动运行时的onDestroy系统杀呢? [英] Will activity run onDestroy when system kill it?

查看:172
本文介绍了将活动运行时的onDestroy系统杀呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,当系统杀死这种意志的活动运行的方法的onDestroy?

I am wondering that will activity run the method "onDestroy" when killed by system?

例如,当活动A的状态的onStop(用户可以直接preSS Home键),
同时,系统发现,该内存不够那么系统必须杀死一些后台进程,以保持前台活动ALIFE,说杀系统A.活动

for example, when the state of "activity A" is onStop ( user may press the Home button directly ), at the same time, system find out that the memory is not enough so system have to kill some background processes to keep foreground activity alife, say system kill activity A.

威尔活动运行在这种情况下方法的onDestroy?

Will activity A run the method "onDestroy" in this situation?

推荐答案

这将完全取决于当时的系统状态。文档清楚地说,大约的onDestroy()是:

It will purely depend on the system condition at that time. Docs clearly says about onDestroy() that:

在有些情况下,系统只会杀死活动的
  托管进程在不调用它这个方法(或任何其他人),所以
  它不应该被用来做是为了保持乾坤
  处理过程进入后离开。

There are situations where the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it should not be used to do things that are intended to remain around after the process goes away.

请参阅这里

这篇关于将活动运行时的onDestroy系统杀呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆