android - Problems redirecting to an Activity with intents -


the problem: lets have 3 activities: mainmenu, levelselection , game. have button run intent in mainmenu redirect player levelselection. in levelselection button redirect player game. when activity game ends run intent redirect player mainmenu activity. however, when tested, redirection done levelselection instead of mainmenu.

mainmenu => levelselection code

this.finish(); intent intent = new intent(this, levelselection.class); this.startactivity(intent); 

levelselection => game code

this.finish(); intent intent = new intent(this, game.class); this.startactivity(intent); 

game => meainmenu code

this.finish(); intent intent = new intent(this, mainmenu.class); this.startactivity(intent); 

thanks in advance.

in manifest, set no history true activities. prevent user going previous activity when current 1 closes (or when user presses "back"). might helpful since you're trying have strict control on activity user goes to.

i remove this.finish(). think you're closing activity before intent started. hence why goes previous activity instead of new one.

another solution set 'no history' 'true' levelselection. then, can close 'game' activity, , should go mainmenu.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -