user963313
user963313

Reputation: 79

How to disable all buttons in Java, Android

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

Upvotes: 2

Views: 2956

Answers (2)

Emmanuel
Emmanuel

Reputation: 17051

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);

Upvotes: 1

Caffeinated
Caffeinated

Reputation: 12484

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

Upvotes: 1

Related Questions