I can disable home button for Android 2.2, 3.0 etc. But same code does not work for 4.0. Is there any solution to disable home button?
@Override
public void onAttachedToWindow()
{
super.onAttachedToWindow();
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
}
Disabling the Home Button , many developers ask about such a feature!! but all I can say: you should absolutely not be disabling the home button in an Android application. This is a major anti-pattern , and will both make your app labelled as spammy and malware-like . Users hate when you disable their home button, and you should really avoid it at all costs. It's not against the law to do this , but your users will get pissed off and you will get a low ratings on google play for your app. Also This technique no longer works in Android 4.0 , for obvious security reasons!!
u can simply add following code to ur android manifest:
<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"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.