问题
I have 3 activities. start / game / finish, I want to go start to game, game to finish, finish to start. but when I use Intent one to another when I finish() "finish" Its come back to game. It should come back to start. so It needs a design kind of all Intents under start activity.
so I tried this one and expected when I finish() "finish" application will be destroy but It didnt work
Intent intent = new Intent(getApplicationContext(),FinishScreen.class);
startActivity(intent);
Q: so how can I start finish activity Intent under start activity but from game activity
回答1:
When you call startActivity(...) in "game" Activity to start the "finish" Activity, immediately call finish() so "game" terminates. If you do that then BACK in the "finish" Activity will return to "start" because "game" self-terminated.
Intent intent = new Intent(getApplicationContext(),FinishScreen.class);
startActivity(intent);
finish();
回答2:
The finish() method should work, try with: System.exit(0);
来源:https://stackoverflow.com/questions/8858229/android-how-to-switch-between-intents