I have an application that has a Login screen, it is the app's initial call. When logging in, the ActivityMain is called and the app follows its flow.
I would like to control the back button event of the android, I would like that when I click the back button I would not go back to the Login Activity. The back button of the android itself, not that of the actionbar. I've put the code below, but I do not think it's the best way to treat it.
@Override
public void onBackPressed() {
Intent intent = new Intent(MainActivity.this,MainActivity.class);
startActivity(intent);
}