when I try to quit my Android application by overwriting the function for the back-button of Android devices and "System.exit(0)", this doesn't work.
I have an activity named "LoginActivity" and an activity named "OverviewActivity".
When I start an intent in OverviewActivity to switch to LoginActivity, this works.
Intent changeViewIntent = new Intent(OverviewActivity.this,
LoginActivity.class);
startActivity(changeViewIntent);
Now I am in LoginActivity and there is the overwritten method:
@Override
public void onBackPressed() {
System.exit(0);
}
But when I press the back-key (e.g. in the device simulator) the screen is blank for a millisecond and then it goes back to the OverviewActivity.
Why is this happening? I just want to force the close when the back-key is pressed.
History disabling for the OverviewActivity in the manifest is no option, because there are several ways to access the OverviewActivity from other activities.
Maybe there is an idea? Android 4 is minimium requirement, so it doesn't have to work on lower versions..
Thanks!
The Exit is possible by deleting the whole activity-call-history and starting the Home-Activity of the Home-Scrren.