Reuse same framgent object in FragmentTransaction android -
i trying add fragment(b) inside fragment(a). , using code below.
fragment fragmentb = new fragmentb(); public void navigatetofragmentb(){ //adding data fragmentb. //fragmentb.addqueryparams(); fragmenttransaction fragmenttransaction = getchildfragmentmanager().begintransaction(); fragmenttransaction.replace(r.id.fragmentarootlayout, fragmentb); fragmenttransaction.commit(); }
let's say, @ first, trying inflate fragmentb inside fragmenta queryparams queryparamold. it's working fine. now, problem arises when trying inflate fragmentb again different queryparams queryparamnew. it's not working. can me find out solution?
one possible solution move fragment fragmentb = new fragmentb() inside method(navigatetofragmentb()). but, don't want re-create object.
Comments
Post a Comment