i doing nested fragment , manage getchildfragmentmanager() , found problem of sequence add fragment mactive list reversed , cause problem when display
fragmentmanager m = parentfragment.getchildfragmentmanager(); fragmenttransaction t = m.begintransaction(); for(int i=0; < 5; i++){ t.add(fragment.instantiate(context, "com.app.user.fragment"), ""); } t.commitallowingstateloss(); m.executependingtransactions(); t = m.begintransaction(); (fragment f : m.getfragments()){ t.remove(f); } t.commitallowingstateloss(); m.executependingtransactions();
in case, found mactive arraylist still allocated 5 spaces, if add other fragment again, added mactive[4] down mactive[0], allocate new space, mactive[5], mactive[6] ...... hence sequence out of control.
anyone face before ? bug in android ? solution ? thanks
Comments
Post a Comment