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
Asked
Active
Viewed 2,942 times
2
-
1You can't and shouldn't. You can specify your activity wants all button-related events and consume them, but it doesn't work for all buttons. – dtech Oct 01 '11 at 18:30
-
And do you think the OS should allow an application like that ? – Diego Torres Milano Oct 01 '11 at 19:40
2 Answers
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