Reputation: 441
I am developing an application that I don't want user to touch home/back button. Trust me, I have a good reason for it. What I need to do is to disable home/back or even the keyboard using terminal. I've look through commands in adb shell already and I cannot find any command to fix this.
Upvotes: 0
Views: 980
Reputation: 1641
Using the following piece of a code in an Activity subclass would work for intercepting key events:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return true;
// return super.onKeyDown(keyCode, event);
}
The back key is the constant KeyEvent.KEYCODE_BACK; the home button should be similar.
Upvotes: 1
Reputation: 43098
I'm not sure about AVD, but in real phone this buttons are hard buttons. So, no software can remove them. All you can do is to override the behaviour for this buttons using onKeyDown()
method.
Upvotes: 1