0

I'm creating lock screen application. and all activity work perfectly, But when screen lock activity comes up on screen on, all Home and task navigation button works. Only back button is not working because I have return nothing in onBackPressed() method.

Now I don't know how to disable this navigation buttons to work in my lockscreen application.

I have tried this:

@Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {

 if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)||(keyCode ==   KeyEvent.KEYCODE_POWER)||(keyCode == KeyEvent.KEYCODE_VOLUME_UP)||(keyCode == KeyEvent.KEYCODE_CAMERA)) {
    //this is where I can do my stuff
   return false;
}
if (keyCode == KeyEvent.KEYCODE_MENU) {
//Do Code Here
// If want to block just return false
return false;
}
if (keyCode == KeyEvent.KEYCODE_HOME) {
//Do Code Here
// If want to block just return false
return false;
}

But Only back button stops working all other remain as it is.

James Z
  • 12,209
  • 10
  • 24
  • 44
hardwork
  • 781
  • 7
  • 14

0 Answers0