android - attach and detach a fragment from another -
i have 2 fragments. want update fragment #2 in background fragment #1.
fragment #2 favorite list fragment... , in fragment #1, data json , populate listview. have refresh fragment #2 have new favorited item. decided reload fragment #2 when user clicks on bookmark icon fragment #1.
i tried inside fragment #1:
fragment frg = null; frg = getactivity().getsupportfragmentmanager().findfragmentbytag(fragment#2.mytag); final fragmenttransaction ft = getactivity().getsupportfragmentmanager().begintransaction(); ft.detach(frg); ft.attach(frg); ft.commit();
but frg
returning null
...
how can achieve this!?
Comments
Post a Comment