Android fragments not popping with POP_BACK_STACK_INCLUSIVE -


i have 3 screens, 1 screen pick sort of document. second screen take photo, screen sends uri of taken photo within bundle third screen. third screen screen edit photo. when going first screen want screen clear backstack can select new things.

however when use

getactivity().getsupportfragmentmanager()                     .popbackstack(null, fragmentmanager.pop_back_stack_inclusive); getactivity().getsupportfragmentmanager().begintransaction()                     .replace(r.id.fragment_container, new fragmentpickdocument())                     .addtobackstack("pickdocument").commit(); 

and start on screen 1, same image appears on screen 3 first go. reason when clearing backstack fragments stay alive , reappear same variables.

how happening?

edit :

every code im adding screen 1.

getactivity().getsupportfragmentmanager().begintransaction()                         .replace(r.id.fragment_container, new fragmenttakephoto())                         .addtobackstack("takephoto").commit(); 

screen 2:

fragmentmanager manager = getactivity().getsupportfragmentmanager(); fragmenttransaction trans = manager.begintransaction();  fragment frag = new fragmenteditphoto(); bundle bundle = new bundle(); bundle.putstring("uri", filepath.tostring()); frag.setarguments(bundle);  trans.replace(r.id.fragment_container, frag); trans.addtobackstack("editphoto"); trans.remove(fragmenttakephoto.this); trans.commit(); 

screen 3 first code in post.

getactivity().getsupportfragmentmanager()                     .popbackstack(null, fragmentmanager.pop_back_stack_inclusive); getactivity().getsupportfragmentmanager().begintransaction()                     .replace(r.id.fragment_container, new fragmentpickdocument())                     .addtobackstack("pickdocument").commit(); 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -