2

I create an app which need to disable all buttons to allow user to leave the application - back button, menu button, camera button, call button, etc, and app should have 1 button for exit. I don't know how to disable all buttons. Tell me please, thank you

user963313
  • 79
  • 5
  • 9

2 Answers2

1

The Physical buttons? No, you can't disable all of them. Home button needs to work... Android - Is It possible to disable the click of home button

Related: Android: mass enable/disable buttons

Community
  • 1
  • 1
Caffeinated
  • 11,982
  • 40
  • 122
  • 216
1

Try this: when you enter the activity, call

getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);

and when you exit the activity, call

getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION);
Emmanuel
  • 16,791
  • 6
  • 48
  • 74