How To Block Home Button On Android 4.4?
On Android 4.4 I develop a lockscreen app, but in lockscreen activity I can't block home button. Can anyone solve it?
Solution 1:
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);
}
Post a Comment for "How To Block Home Button On Android 4.4?"