Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the home key

I'd like to lock the screen. I want to disable the home key and only use the back key. How do I accomplish this?

like image 536
pengwang Avatar asked Oct 10 '10 03:10

pengwang


2 Answers

Use this method to disable the Home key in android

@Override public void onAttachedToWindow() {     this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);     super.onAttachedToWindow(); } 
like image 167
ASH Avatar answered Sep 22 '22 23:09

ASH


I found a way to tackle the HOME key. For your application set the manifest as

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

Now your application is an alternate Launcher application.

Use the adb, and disable the launcher application using package manager

pm disable com.android.launcher2 

Now the Home key press will always stay in the same screen.

like image 40
amiekuser Avatar answered Sep 21 '22 23:09

amiekuser