java - Intent.FLAG_ACTIVITY_CLEAR_TOP in SherlockActivity not serving the purpose -
the scenario :
i have 4 activities : a, b, c , homeactivity
. a
launcher
activity. using actionbarsherlock
, a,b , c have menu
option in bar.
the flow :
a-> b-> c --**on submit in c**--> homeactivity
now when press back
button on home activity, goes activity b
after clicking submit in c
, using
intent intent = new intent(this, homeactivity.class); intent.setflags(intent.flag_activity_clear_top ); //shouldn't clear a,b , c ?? //intent.addflags(intent.flag_activity_clear_top ); startactivity(intent); finish();
but remain on homeactivity data submitted , started.
also if menu button pressed on a,b,c
, homeactivity started , in case, have default behaviour of back
button(i.e go activity in menu pressed)
any insights on how flag_activity_clear_top
not serving purpose!
(p.s. : homeactivity not launcher activity)
i think finish home acitivity while go home activity -> activity a. when using clear top flag home activity should alive in stack. please make sure not finish home activity.
and put code onkeydown() method in home activity.
@override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { log.e("onkeydown>>>>", "called>>>>>"); finish(); } return super.onkeydown(keycode, event); }
check more details check link:
other way
edit:
try put above code activity a.
remove finish() method code below:
intent intent = new intent(this, homeactivity.class); intent.setflags(intent.flag_activity_clear_top ); //shouldn't clear a,b , c ?? //intent.addflags(intent.flag_activity_clear_top ); startactivity(intent);
and important thing don't finish activity launcher activity clear top method should in stack of activity remain present in device.
hope solve problem.
Comments
Post a Comment