Can I override the 'Home' button in my application?
android
Solution
This answer will no longer work, not since Android 4.0.
The correct solution is to create an app that can intercept the Home intent, as per @bara's answer below.
You can override the home button as any other 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);
}
Problem
I want to create my own 'home' screen on my android, and I want to call that home screen from my application. How can I override the 'Home' button so that when it's pressed the application will be redirected to my home screen instead of the default home screen? Is it possible to override the home button?