On Android 4.4 I develop a lockscreen app, but in lockscreen activity I can't block home button. Can anyone solve it?
Asked
Active
Viewed 534 times
1 Answers
-2
Override the onKeyDown function of the activity and then catch the event for the home button.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_HOME)) {
Toast.makeText(this, "You pressed the home button!", Toast.LENGTH_LONG).show();
return true;
}
return super.onKeyDown(keyCode, event);
}

Mobility
- 263
- 2
- 5