-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
  • 705
  • 6
  • 25
  • Possible duplicate of [Disable back button in android](https://stackoverflow.com/questions/4779954/disable-back-button-in-android) – Firu 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,062
  • 9
  • 31
  • 41
0

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

like

    @Override
    public void onBackPressed() {
        // super.onBackPressed();
    }
Basi
  • 2,892
  • 22
  • 28