-5

When I try to add back button removal code, it gives error.

I created a game with buildbox, it's a drag and drop, and exported it to the Android Studio. I want to disable the android back button. Please, I need help on how to go about this.

ardiien
  • 767
  • 6
  • 26
  • Possible duplicate of [Disable back button in android](https://stackoverflow.com/questions/4779954/disable-back-button-in-android) – Firdous nath Mar 27 '19 at 11:11

2 Answers2

1

Add to your Activity class EMPTY onBackPressed method:

In Kotlin:

override fun onBackPressed() {

}

In Java:

@Override
public void onBackPressed() {

}
Boken
  • 4,825
  • 10
  • 32
  • 42
0

override onBackPressed() method also remove super.onBackPressed()

like

    @Override
    public void onBackPressed() {
        // super.onBackPressed();
    }
Basi
  • 3,009
  • 23
  • 28