Sabin Acharya
Sabin Acharya

Reputation: 513

Updated items on recyclerView are lost when view pager is used

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.

enter image description here

Upvotes: 1

Views: 413

Answers (1)

Harish Kamboj
Harish Kamboj

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

Related Questions