Reputation: 513
When i change recyclerView
data of one tab,data is being reflected(working fine), but when i switch to other tabs and go back to updated tab , the updated items on recyclerView
are lost .how to notify viewpager
adapter that i have changed data in recyclerAdapter
.
Upvotes: 1
Views: 413
Reputation: 907
Actually, ViewPager loads the next and previous (if any) fragment on initialization and if you will go to the second tab it will load 3rd automatically. You need to use:
viewpager.setOffscreenPageLimit(3);//3 is the limit not refreshing the fragment till 2 swipes
Hope this will solve your problem.
Upvotes: 1