且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

活动在强制关闭时重新启动

更新时间:2023-01-26 14:54:29

这里是一些有用的信息:

就活动何时重新启动而言——如果运行该活动的进程前台活动消失,系统将丢弃该活动,如果它没有有效的保存状态(通常意味着它已暂停并且已经给了系统 onSaveInstanceState 之前的结果暂停).一旦它决定是否丢弃该活动,它将恢复现在位于堆栈顶部的任何活动.如果这是你的一项活动——要么是因为你有另一项活动崩溃了,或者崩溃的那个不知何故是稳定的暂停状态-- 然后它将再次启动您的流程以显示该***活动.

As far as when an activity is restarted -- if the process running the foreground activity goes away, the system will throw away that activity if it does not have a valid saved state for it (typically meaning it is paused and has given the system the result of onSaveInstanceState from before the pause). Once it has decided whether or not to throw away that activity, it will resume whatever activity is now at the top of the stack. If this is one of your activities -- either because you have another behind the one that crashed, or the one that crashed was somehow it the settled pause state -- then it will start your process again to show that top activity.