I am working in an launcher application ,In which i have to disable the home button event. How can we do this in android 4.0 and above.
Asked
Active
Viewed 964 times
-3
-
possible duplicate of [Override home and back button is case a boolean is true](http://stackoverflow.com/questions/10025660/override-home-and-back-button-is-case-a-boolean-is-true) – Siddharth Lele May 16 '13 at 12:05
-
possible duplicate of [How to disable the home key](http://stackoverflow.com/questions/3898876/how-to-disable-the-home-key) – Useless May 16 '13 at 15:26
3 Answers
2
There is no way to intercept the home button on Android, unless you make your app the home screen. This is for security reasons, so that malicious apps cannot take over your device by overriding all the buttons that can exit. The home button is the one sure shot way to be able to leave any app.
If you want to handle the HOME button, implement a home screen.
For more information check the link below. check the answer by commonsware

Community
- 1
- 1

Raghunandan
- 132,755
- 26
- 225
- 256
0
Here you have ;)
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HOME)
{
return true;
}
return super.onKeyDown(keyCode, event);
}
You should use this in your activities.

Jose Antonio Benitez Montero
- 1,846
- 2
- 19
- 25
-
1From the [docs](http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_HOME): *This key is handled by the framework and **is never delivered to applications**.* – adrianp May 16 '13 at 12:03