I'm doing a game in Android Studio and at a certain moment I'm going to another screen. How can I say "block" that new screen to avoid going back? Thanks!
I'm doing a game in Android Studio and at a certain moment I'm going to another screen. How can I say "block" that new screen to avoid going back? Thanks!
If you want to avoid returning to the previous screen by pressing the back button, you overload the event onBackPressed () of your Activity .
@Override
public void onBackPressed(){
//En caso de querer permitir volver atrás usa esta llamada:
super.onBackPressed();
}
To go back without having to press the button you can use finish () .