-6

How to disable back button in Android code level?

Once the app is loaded the user should not be allowed to press back button. Is it possible?

Thanks.

1 Answers1

2

Override onBackPressed() as shown below:

@Override
public void onBackPressed() {
    // do nothing.
}
Gokul Nath KP
  • 14,745
  • 24
  • 85
  • 122