有什么办法退出应用程序时,home键是pressed在Android? [英] Is there any way to exit the application when home button is pressed on Android?
本文介绍了有什么办法退出应用程序时,home键是pressed在Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要杀死应用程序时,用户presses home键。有没有办法做到这一点在Android?
I want to kill the app when user presses the home button. Is there any way to do this on Android?
推荐答案
我实现通过重写类似 Activity.onUserLeaveHint()
。此方法被调用一次,home键是pressed但我觉得在那里有一些注意事项我不记得现在。即它得到了号召情况下,我不希望我的应用程序完成,并不得不把标志prevent不必要的退出。
I implemented something similar by overriding Activity.onUserLeaveHint()
. This method gets called once home key is pressed but I think there where some caveats I can't remember right now. Namely it got called on situations I didn't want my application to finish and had to put flags to prevent unwanted exits.
这篇关于有什么办法退出应用程序时,home键是pressed在Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文