Simple implementation of android4.0 masking the HOME key

  • 2020-05-27 07:08:25
  • OfStack

In android2.2 2.3 it can be rewritten by activity

public void onAttachedToWindow() {

This function shields the Home key.

This method will not work after android 4.0. Here's how to block the Home key after android 4.0.

public static final int FLAG_HOMEKEY_DISPATCHED = 0x80000000;

Add the following code to the onCreate function


The above method can shield the Home key in android4.0 after personal test.

Related articles: