1

I am developing lock screen application in android.

The problem is how to disable Back, Home and Recent button in the activity?

I found that back button disable using:

@Override
    public void onBackPressed() {
        return;
    }

But how to disable the others?

Problem image: http://postimg.org/image/a0tnk7kr5/

Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87
Rank Mayur
  • 116
  • 2
  • 14

2 Answers2

0

You have to override the Back action and return true to let the OS know that this action already handled and prevent executing the default action for that, which is closing the screen

Your code is valid for API level 5, but for older then API 5 use this:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
    // your code
    return true;
}

return super.onKeyDown(keyCode, event);
}

reference: Answer

This question is asking about how to disable the Home and Recent buttons like the MXPlayer application when you click on the Lockscreen. The accepted answer says that

Since you cannot override the Home button on Android device (at least no in the latest OS versions). MX Player draws itself on top of your launcher when you "lock" the app and clicks on the Home button.

and gives a details description how to do that. Check it out here

Community
  • 1
  • 1
Sami Eltamawy
  • 9,874
  • 8
  • 48
  • 66
-2

Actually it is a problem with your touch screen Even your screen parts are working You can download (button savior) app It will add you a extra back home and recent button to your mobile