了解isFinishing的() [英] Understanding of isFinishing()

查看:88
本文介绍了了解isFinishing的()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读的Andr​​oid DOC约 isFinishing()中的 http://developer.android.com/reference/android/app/Activity.html

I got confused after reading Android doc about isFinishing() in http://developer.android.com/reference/android/app/Activity.html

如果我称之为 isFinishing()的onPause(),有什么返回值 isFinishing()呼叫应在以下3个方案?

If I call isFinishing() in onPause(), what the return value of isFinishing() call should be in the following 3 scenarios?

  1. 在活动中被杀害由于完成()被调用。
  2. 一个活动不是在前台和活性(未应用程序)被杀死的OS由于低存储器。
  3. 在活动即将背景。

我相信结果 isFinishing()将的真正的方案1中,将是的在方案3。

I am sure that the result of isFinishing() will be true in scenario 1 and will be false in scenario 3.

怎么样的场景2?请问 isFinishing()返回的真正的在场景2?

How about scenario 2? Will isFinishing() return true or false in scenario 2?

推荐答案

您的活动没有得到由OS死亡,而这是在前台。这是没有意义的。

Your Activity doesn't get killed by the OS while it's in the foreground. That wouldn't make sense.

然而,如果活动转到背景因为用户切换到不同的应用程序,它可以得到后的onPause杀死()已被处理。因此,你可以得到 isFinishing()==假为用户切换到一个新的应用程序,但随后的应用程序被杀害。

However, if the activity goes to the background because the user switched to a different app, it could get killed after onPause() has been processed. As such, you could get isFinishing() == false as the user switches to a new app, but then the app is killed.

由于医生说,保存的onPause所有持久性数据()的onDestroy()不能保证被调用。

As the doc says, save all persistent data in onPause(). onDestroy() is not guaranteed to be called.

(我不会感到惊讶,如果戴安娜有步骤,这里纠正我,顺便说一句。)

(I wouldn't be surprised if Dianne steps in and corrects me here, btw.)

这篇关于了解isFinishing的()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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