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_top when using flag_activity_clear_top prevent "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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -