how to disable home button in android?

I think this can be done in another style if suits your requirement. By creating your activity as home activity. If you want to disable home button and show your custom application activity as launcher when home button is pressed. Just add these lines in manifest for that activity for which you want your launcher.

<activity
            android:name="com.example.TempActivity"
            android:clearTaskOnLaunch="true"
            android:excludeFromRecents="true"
            android:launchMode="singleTask"
            android:screenOrientation="landscape"
            android:stateNotNeeded="true" >
             <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>
</activity>

After adding and run your application. if user presses the home button, Android will ask for which launcher you want your home. Then your have to select your application launcher ALWAYS not ONLY ONCE.

if you want fully disable the user, so that he cant move to another screen then set theme to fullscreen with NoTitlebar.

Leave a Comment