android - Cannot set both FLAG_ACTIVITY_SINGLE_TOP and FLAG_ACTIVITY_CLEAR_TOP in one intent? -
i'm using flag flag_activity_single_top , flag_activity_clear_top go previous "standard" activity. use flag_activity_single_top prevent re-creating new instance. found flag flag_activity_single_top neglected , activity finished , re-created.
here found in docs. flag_activity_clear_top: says can add
flag_activity_single_topwhen usingflag_activity_clear_topprevent "finish - recreate".here doc. flag_activity_clear_top:
note: if launch mode of designated activity "standard", removed stack , new instance launched in place handle incoming intent. that's because new instance created new intent when launch mode "standard".
did misunderstand first doc?
the documentation suggests flag_activity_clear_top need set. have set both prevent activity being created again.
this did trick in case: (main being activity wanted return to)
intent tabintent = new intent(this, main.class); tabintent.setflags(intent.flag_activity_single_top | intent.flag_activity_clear_top); startactivity(tabintent);
Comments
Post a Comment