0
I have an application that has a login screen, it is the initial call of the app. When logging in, it is called Activitymain and from it the app follows its flow.
I would like to control the event of the back button of android, I would like to click the back button do not return to the Login Activity. The back button of the android itself, not the actionbar. I broke the code, but I don’t think it’s the best way to treat him
@Override
public void onBackPressed() {
Intent intent = new Intent(MainActivity.this,MainActivity.class);
startActivity(intent);
}
In Activitylogin, you have to give a Finish(); so that when the back is pressed it closes the main and goes back to android. Don’t forget to delete these changes in backpressed
– Luccas Melo
It worked just fine Thank you very much.
– Henrique