Pressing Home twice will always take a user back to the center panel of the Home Screen, so whatever application they're running, it's easy for a user to get back to somewhere they know. You shouldn't really be overriding this unless you're producing a full Home replacement.
Don't permanently override the Home button without the user confirming it.
We need to do follow three steps here...
1. Override onKeyDown and compare keycode with KeyEvent.KEYCODE_HOME
2. Override
onAttachedToWindow()
3. add category to the activity because
CATEGORY_HOME : This is the home activity, that is the first activity that is displayed
when the device boots.
<category android:name="android.intent.category.HOME"/>Solution: Source Code Here
This solution is for lower version .Do we have the procedure for versions above ICS?
ReplyDeleteThere is no direct approach as we have for below ICS but If u want to trigger home button still we can do with flags.
DeleteBut by using flags the hardware keys are blocked and we should handle all the hardware keys function programmatically.