Lam Tran
Lam Tran

Reputation: 441

How to disable (or hide) home button in AVD

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

Answers (2)

DMags
DMags

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

Vladimir Ivanov
Vladimir Ivanov

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

Related Questions