Android Honeycomb Home Button 杀死应用程序

发布于 2024-12-20 08:58:22 字数 260 浏览 3 评论 0原文

我有一个应用程序,您可以在其中输入一些数据。 PRE-Honeycomb 行为如下:

  • 后退按钮似乎杀死了应用程序,所有输入数据都丢失了
  • 主页按钮似乎暂停了应用程序,下次启动应用程序后所有输入数据仍然存在

对于 Honeycomb 主页的行为按钮好像变了。按主页按钮并再次启动应用程序后,所有输入数据都会丢失。这是故意的吗?问题是我可以覆盖后退按钮来保存数据,但是阅读各种帖子我无法覆盖主页按钮。这是预期的行为还是错误?怎么处理呢?

I have an app where you enter some data. The PRE-Honeycomb behavior is the following:

  • back button seems to kill the app, all input data is lost
  • home button seems to pause the app, all input data is still there after the next start of the app

For Honeycomb the behavior for the home button seems to have changed. After pressing the home button and start the app again all input data is lost. Is that intented? The problem is that I can override the back button to save data, but reading various posts I cannot override the home button. Is that an expected behavior or a bug? How to deal with it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们只是彼此的过ke 2024-12-27 08:58:22

只要您的应用程序不可见,系统就可以停止它。如果您的应用程序被隐藏,您不应该假设它仍然在后台运行。如果您想保证数据不丢失,请确保将其保存在 onPause() 中的某个位置,并在 onResume() 中再次恢复。

Any time your app is not visible, it is eligible to be stopped by the system. You shouldn't assume anything about your app still running in the background if it's been hidden. If you want to guarantee data is not lost, make sure you save it somewhere in onPause() and restore it again in onResume().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文