杀戮暂停Android应用 [英] Killing android application on pause

查看:180
本文介绍了杀戮暂停Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想一个应用程序是完全禁用/暂停时关闭(即当用户presses的HOME,END(通话)和后退按钮,我想应用程序被关闭,而不是被保存在历史堆栈)。

I have an application which I would like to be fully disabled/closed when it is paused (IE. When the user presses the Home, End (call) and Back button I would like the application to be closed, instead of being saved in the history stack).

我如何做到这一点....?

How do I do this....?

感谢。

推荐答案

实施的onPause()在你的活动,并呼吁完成()您的活动。请记住,虽然,这将发生在每一个停顿,包括对话,来电,用户激活通知。您可能要考虑做完成()的onStop(),这至少会解决这个对话框问题。

Implement onPause() in your activity and call finish() on your activity. Bear in mind, though, that this will occur on every pause, including dialogs, incoming calls, users activating a Notification. You might want to consider doing finish() in onStop(), which would at least solve the dialog problem.

另外,要记住,用户将可以使用您的应用程序时,认为它已经崩溃,因为它走了,当他们试图取回它感到困惑。

Also, bear in mind that users will may get confused when using your app, thinking it has crashed since it is gone when they try to get back to it.

这篇关于杀戮暂停Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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