Android stack is not getting clear -


i have got stuck in situation please me .here problem .i have menu screen in application.now have given option go menu screens has not come directly menu screen .for example go activity b menu ->activity -->activity b. have written on pressing backtomenu button.

this.finish(); startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_top)); 

i not finishing activity because want on activity when press button on activity b.so on stack when press menu button on activity b. come menu screen fine when press on menu screen come activity a.which not wanted.i tried

this.finish(); startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_task|intent.flag_activity_clear_top)); 

and

  startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_task|intent.flag_activity_new_task)); 

but haven't worked.please me.

you can solve issue following solution.

  1. using normal observer pattern implemented using core java. observer pattern refer this

  2. or same pattern implemented in android broadcast receiver. in solution every activity registered custom broadcast massage , once launch menu activity broadcast message registered activities can listen message , finish itself.

let me know if have issue in above.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -