Android - Is It possible to disable the long click of home button to avoid the task manager?

被刻印的时光 ゝ 提交于 2019-11-27 02:50:41

问题


I am looking for a way to disable the task manager window once I long press on the home button. I managed to disable other device keys (such as volume, menu etc) and the normal click on the home button as I am the default launcher, but I don't know how to disable the task manager! Even Toddler Lock kids app show u the task manager screen following long click, so I assume it isn't easy to do so. I saw few answers say I shouldn't disable the task manager, but I want to have it from another key instead the long click on home button. If needed and will solve my problem, I can be rooted. Please help.

I found a way to do so with Android 2.3.5: Override home and back button is case a boolean is true (I used the piece of code from hotveryspicy) But, as written in this link, this solution isn't working with Android 4.0.3 Can u help me to find a solution for 4.0.3 as well?


回答1:


To avoid the recent app dialog on the long click home button, you can listen on focus of your activity. When your activity is loosing focus, fire an Intent.ACTION_CLOSE_SYSTEM_DIALOGS intent.

Sample code here: http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/

I hope this will help you :)



来源:https://stackoverflow.com/questions/11882581/android-is-it-possible-to-disable-the-long-click-of-home-button-to-avoid-the-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!