Rhn Bhadani
Rhn Bhadani

Reputation: 294

Disable Home button in upper version on 4.0

I want to disable Home buttion, Below code i tried:

    @Override
    public void onAttachedToWindow() {
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    super.onAttachedToWindow();
}

From Android 4.0 (ICS) onward KEYCODE_HOME has been deprecated.User can pressed the Home button to navigate to other application. But android keep the current application as it is state in the background. So that user can back to the previous application.

Is there any solution to do this in above 4.0 version I have go through so many blogs but none of works.

Thank You

Upvotes: 0

Views: 190

Answers (1)

Gopal Sharma
Gopal Sharma

Reputation: 300

There is no way to intercept the home button on Android, unless you make your app the home screen. This is for security reasons, so that malicious apps cannot take over your device by overriding all the buttons that can exit. The home button is the one sure shot way to be able to leave any app. Please go through below link http://abhik1987.wordpress.com/tag/android-disable-home-button/

Upvotes: 1

Related Questions