0

I have a main Activity with a ViewPager with three tabs, where each tab has a Fragment with a RecyclerView which is filled by my webservice data.

fragment_1 has a list of users who I'm following. fragment_3 has the list of users that I can follow.

When I click on an item of fragment_3, fragment_1 should be updated, with the new User I'm following.

I saw this solution enter link description here, but I think my situation is somewhat different in that when I click on fragment_3 tab, the fragment_1 is destroyed.

Please help.

Community
  • 1
  • 1
sThiago
  • 215
  • 1
  • 10
  • why don't you maintain all list in the main Activity itself and modify the list accordingly by using a listener in all fragments – Shadow Droid Oct 11 '15 at 15:31

1 Answers1

0

I think that's somewhat related how you set up the PagerAdapter, myPager.setOffscreenPageLimit(how_many_pages_to_keep_alive); should do the trick!

public void setOffscreenPageLimit (int limit) Set the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state. Pages beyond this limit will be recreated from the adapter when needed.

fiipi
  • 663
  • 6
  • 20