android - How to get the reference of a fragment created by FragmentTransaction.replace method -
i added fragment inside activity using following code:
fragmenttransaction ft = getactivity().getsupportfragmentmanager().begintransaction(); ft.replace(r.id.parent_fragment_container, new folderstructurefragment()); ft.commit();
my question how can reference of added fragment. have searched lot of key words related fragment , fragmenttransaction didn't find close requirement think basic function , should offered us. appreciated!
try using below code.
folderstructurefragment folderstructurefragment = (folderstructurefragment)getactivity().getsupportfragmentmanager().findfragmentbyid(r.id.parent_fragment_container);
Comments
Post a Comment