由网友(油﹌漆店里の老情亼)分享简介:我要杀死应用程序时,用户presses home键。有没有办法做到这一点在Android?I want to kill the app when user presses the home button. Is there any way to do this on Android?推荐答案我实现通过重写类似 A...
我要杀死应用程序时,用户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.
相关推荐
最新文章