This occurs both when the back button is overwritten or if I just make it an onclick on some other button.
What happens is that when the key is pressed, all activities are cleared, and the android’s homescreen is shown for a second or so before the other.class is shown.
This does not occur on any other device I have tested.
Any input?
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent switchScreen = new Intent(this, other.class);
switchScreen.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(switchScreen); }
return super.onKeyDown(keyCode, event);
}
That is correct behavior.. However, the problem can be solved.
Solution
onCreate() of the other-
Activityand in your
Manifest.xml