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

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -