Problems redirecting to an Activity with intents?

Try this, while calling your MainMenu activity from Game activity: Intent intent = new Intent(this, MainMenu. Class); intent. AddFlags(Intent.

FLAG_ACTIVITY_CLEAR_TOP); this. StartActivity(intent) Hope this would help.

Try this, while calling your MainMenu activity from Game activity: Intent intent = new Intent(this, MainMenu. Class); intent. AddFlags(Intent.

FLAG_ACTIVITY_CLEAR_TOP); this. StartActivity(intent); Hope this would help.

In the manifest, I would set No history to true for all your activities. This will prevent the user from going back to a previous activity when the current one closes (or when the user presses "back"). This might be helpful since you're trying to have strict control over what activity the user goes to.

I would also remove this.finish(). I think you're closing the activity before the intent is started. Hence why it goes back to the previous activity instead of the new one.

Another solution would be to set 'No history' to 'true' only for LevelSelection. Then, you can simply close the 'Game' activity, and it should go back to MainMenu.

That will solve this problem in particular. However the application is more complex than just 3 activities I was wondering why that behavior was happening. Thanks!

– CapitanNerd Jun 30 at 20:21.

While starting level selection, FLAG_ACTIVITY_NO_HISTORY MainMenu => LevelSelection code this.finish(); Intent intent = new Intent(this, LevelSelection. Class); intent. AddFlags(Intent.

FLAG_ACTIVITY_NO_HISTORY); this. StartActivity(intent); and if you want to go back from Game mode to main menu, simply use, Game => MeainMenu code this.finish().

That will solve this problem in particular. However the application is more complex than just 3 activities I was wondering why that behavior was happening. Thanks!

– CapitanNerd Jun 30 at 20:21 I think when the Game activity is finished, LevelSelection activity is restored. Try calling MainMenu activity without finishing Game activity. – dcanh121 Jun 30 at 20:38 It did not work either.In fact I'm running "finish()" before on every "redirection".

For example when yo finish a level I call "finish()" and then call a method that know if must go back to the main menu (because the game ended) or to the next level. However I tried running "finish()" after calling the intent but the result is the same. – CapitanNerd Jun 30 at 20:54.

This will prevent the user from going back to a previous activity when the current one closes (or when the user presses "back"). This might be helpful since you're trying to have strict control over what activity the user goes to. I would also remove this.finish().

I think you're closing the activity before the intent is started. Hence why it goes back to the previous activity instead of the new one. Another solution would be to set 'No history' to 'true' only for LevelSelection.

Then, you can simply close the 'Game' activity, and it should go back to MainMenu.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions