2

我正在开发一个不支持屏幕旋转的应用程序。我真的需要保存所有活动的实例状态吗?android杀死活动有多罕见?如果活动被杀死并恢复,它只会像用户第一次看到它时那样看起来,如果系统已经杀死它,这可能是很久以前的事了。如果这种情况很少发生,对我来说这似乎不是一个糟糕的用户体验。你怎么看?

4

3 回答 3

2

It is a catastrophic UX if an application loses its state just because I went to the settings to change the screen brightness. This happens frequently on 512MB RAM devices - which are still sold in large quantities. There are even devices with 256MB produced right now.

Yes, it happens a lot. It will happen to certain users much more frequent than to others. Those users will have no pardon with your app.

于 2012-11-15T15:36:45.047 回答
1

it really depends on the type of screens you are developing. When the activity contains a lot of data for example, it should be convenient to save the state of your activity (not all activities).

If you have several fields that the user must refill, it can be a bad experience especially if the virtual keyboard of device is not that easy (assume you are using a Galaxy mini for example)

In other words, it is a good practice but its up to you to decide if the user experience will be degraded or not

Serge

于 2012-11-15T15:31:03.737 回答
1

FWIW,我已经为我们当前的产品编写了几个单向应用程序,我觉得保存状态仍然很重要。当一切都是您返回时离开的方式时,它只会使应用程序更有用。

一般来说,这也不是很多工作。首先,请记住,如果您为布局中的视图分配 ID,则默认的 Activity.onSaveInstanceState() 将完成大部分工作。它会记住 Checkbox 状态、EditText 内容等。您需要保存的内容相对较少。以下是我在状态中保存的一些内容:

  • 相关活动参数
  • 列表查看位置信息
  • TabView 中的当前选项卡

活动参数是迄今为止最常见的。

于 2012-11-15T18:56:30.287 回答