Reputation: 423
I am in my application and I have control back button but I also want to control home button. I have written the code but I am unable to control HOME button. Here is my code. Help me to achieve it.
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK )
{
return false;
}
else if (keyCode == KeyEvent.KEYCODE_HOME)
{
return false;
}
return super.onKeyDown(keyCode, event);
}
Upvotes: 1
Views: 3286
Reputation: 11251
As per Android core concepts, no application can alter the behaviour of the Home
button.
This you may not achieve what you're trying to do.
EDIT
You can try to code one Home Screen Launcher
so that when user presses the home button, they can go to your Home Launcher.
Upvotes: 2
Reputation: 4185
You cannot override the home key function, this functionality would allow an app to lock the user out of the phone.
Upvotes: 7