不要保持活动 - 这是为了什么? [英] Don't keep activities - What is it for?

查看:31
本文介绍了不要保持活动 - 这是为了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是不言自明的.我了解此开发人员选项的作用.

不明白的有以下几点:

  1. 首先为什么要引入该选项?
  2. 框架经历了这么多年的变化,它还有用吗?

我很想知道这个选项背后的原因.

解决方案

我相信这是一个用于调试目的的功能.

来自 Titanium 文档:><块引用>

不要保留活动在开发者选项菜单下.当这选项已启用,Android 操作系统将尽快销毁活动它被停止了.它旨在帮助开发人员调试他们的应用程序.为了例如,它可以模拟Android将杀死一个活动的情况由于内存压力在后台.在正常使用中,它不是建议开启此选项,因为这可能会导致意外应用程序的问题,例如冻结、强制关闭和重新启动.

听起来它基本上有助于确定性测试您的应用在操作系统因任何原因(内存不足等)关闭时的行为方式.

所以,这回答了第 1 点.第 2 点是:是的,我猜:)

编辑:进一步参考

The title is pretty self-explanatory. I understand what this developer option does.

What I don't understand are the following points:

  1. Why was that option introduced, in the first place?
  2. After all the changes that the framework has seen throughout the years, is it still useful?

I am eager to know the reasons behind this option.

解决方案

I believe it's a feature used for debugging purpose.

From the Titanium doc:

Don't keep activities under the Developer Options menu. When this option is enabled, the Android OS will destroy an activity as soon as it is stopped. It is intended to help developers debug their apps. For example, it can simulate the case that Android will kill an activity in the background due to memory pressure. In normal use, it is not recommended to turn this option on because this may lead to unexpected issues on the apps, such as freezes, force closes and reboots.

It sounds like it basically helps testing deterministically how your app behaves when the OS shuts it down due to any reason (out of memory and so on).

So, this replied to point 1. Point 2 is: Yes, I guess :)

EDIT: further references

这篇关于不要保持活动 - 这是为了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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