Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:04:16+00:00 2026-06-03T23:04:16+00:00

I know this question has been asked many times and the answer is always

  • 0

I know this question has been asked many times and the answer is always “No we cant disable home button”.

I have a little different query to ask.

I wrote simple code in which my activity overrides the onKeyDown() and return true for all key presses.

In theory this means whoever opens the application is stuck there and has no option to move out of the application.

When i tested this application on different devices, i made following observations :

  1. On motorola device with OS as 2.2.2 , Home button got disabled.
  2. On HTC device with OS as 2.3.5 , Home button got disabled.
  3. On Sony with OS as 2.3.7 , Home button got disabled.
  4. On Samsung with OS as 2.2.1 and 2.3.3 , Home button got disabled.
  5. On Samsung with OS as 2.3.6 and 4.0.4, Home button remained enabled.

These observations are seems very conflicting.

Does any one have any idea , why different devices are behaving differently and what is the best way to handle such scenario.

As per my understanding till now none of the vendors have customized Android OS . Everyone is putting there UI layer on top of it but no one has touched the internals.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:04:18+00:00Added an answer on June 3, 2026 at 11:04 pm

    As mentioned in my question itself for devices below 2.3.6 OS overriding keypress() functions work well.

    Issue starts with 2.3.6 onwards. I don’t know what these device vendors have done but keypress() function does not functions same on all devices.

    Also from ICS onwards google has stopped using keypress() function once for all.

    So how do we do it.

    The way i see it, if we are trying to override home button then its not possible, but definitely we can listen to it.

    In our android manifest we use <category android:name="android.intent.category.HOME" /> filter than this makes our activity as home replacement screen.
    Now when you will press home button the content resolver pop up will always come up and ask which application i.e the default launcher or your application should respond to home button click. You can always choose your application there.

    But this does not overrides or disables home button. whenever you will press home button same thing will be repeated again and again till you make your application default , by clicking the use as default checkbox given in the content resolver pop up.

    Now once you have chosen your application as default home press will always launch your application.

    Done… no. The issue which arises know is if you move out of your application the home button still launches your application. How to get rid of it once your work is done.

    What we have to do is while closing or calling finish() on our activity , prior to it we should set the package setting to default by using:

    paramPackageManager1.setComponentEnabledSetting(localComponentName2, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 1);

    This will de associate the home button from your activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked many times and we have gotten this
I know this question has been asked many times, but I have not been
I know this question has been asked many times on here but I have
I know this question has been asked many and many times, but I have
I know this question has been asked many times, and I've searched stackoverflow and
I know this question has been asked many times, but my problem is a
I know this is a question that has been asked many times before, but
I know this question has been asked many times, but I never saw a
I know this question has been asked many times and I've researched it myself
I know this question has been asked many times, but I am having trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.