I know that I cant override the home button like with the back button. But can the android system fire an event if the home button is pressed? I want to catch this action in order to show a warning message if the user presses the home button. I've looked into several options, the most obvious one, for beginner would be to override the home button
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HOME) {
// action goes here
} else {
return super.onKeyDown(keyCode, event);
}
}
But this doesnt work, and I'm completly aware of it.
The onPause method will be called once the current Activity
finishes. This method will also be called when the user changes Activity
in my application. So is there anyway I can show the user a notifying box, when he presses the home button?
Thanks in advance