Block home button

0

These last days I've been looking for information on how to disable the start button so the user can not press it while it's touching the screen. I have found that there are some applications that do it drawing on other applications such as MX Player

I have tried to find some more information on how to do it but I have not found anything that would help me. Another method would be to make my application launcher, but that does not interest me.

Does anyone know how to do it with permission to draw?

Many thanks.

    
asked by gery_08 14.01.2018 в 13:19
source

1 answer

1

As a suggestion I mentioned that the home button should not be blocked because it complies with certain design and usability criteria for which it is created. But in case you really need it this code should do the job.

@Override
public void onAttachedToWindow() {
       this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
       super.onAttachedToWindow();

}

Code taken from the following sources:

link

link

I hope this is what you need.}

    
answered by 16.01.2018 / 14:53
source