In my app I want to make a change that at any point of time i.e at any activity I press Home button it shows a dialog box asking for "You want to logout?" .
I have read that overriding of Home button is not possible. Is that true? Any ideas?
In my app I want to make a change that at any point of time i.e at any activity I press Home button it shows a dialog box asking for "You want to logout?" .
I have read that overriding of Home button is not possible. Is that true? Any ideas?
hi you can't handle Home button in android as per to my knowledge. but yes you can do like this follow this Catch keypress with android
There is no direct way to do the same. like you can not get the KeyDown event for the HOME key. but we can get the HOME key captured and stay in the same screen by following code
@Override
public void onAttachedToWindow() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
You can override the "back" button but you cannot override the Home button. It is the user's "ctrl+alt+del" for android!