Lets say I have a a main activity FirstActivity
(when I press the back button here, it just closes the app) and I have another activity called SecondActivity
(FirstActivity goes to this when user is logged in). Now when I press the back button, it goes to FirstActivity
instead of closing the app. Is there any way I can just close the app from SecondActivity
, ignoring any Activity on the back stack? The callback method I use to close the app in my SecondActivity
:
@Override
public void onBackPressed() {
finish();
}