I develop an android application and I need to prevent the user to close the application from navigation bar buttons .. there is another way to close the application. I search a lot and didn't find any way to Permanently hide bottom navigation bar or at least stop all button control
Asked
Active
Viewed 103 times
0
-
What you are asking is not possible. You cannot remove or disable the navigation buttons. You are able to control the "back" button. But there is no way to control the "home" or "recent apps" button. These are system level features and a third-party app does not have control over it. Only a system app can modify those buttons. – ᴛʜᴇᴘᴀᴛᴇʟ Sep 19 '18 at 04:41
2 Answers
1
Use this method to disable the Home button
@Override
public void onAttachedToWindow() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}

Quick learner
- 10,632
- 4
- 45
- 55

moon
- 323
- 1
- 6
0
If you meant to disable the back button on device, you could override
@Override
public void onBackPressed() {
super.onBackPressed(); //delete or comment this line
.......//do something you want
}

navylover
- 12,383
- 5
- 28
- 41