Derive your PagerAdapter class as
public static class MyPagerAdapter extends FragmentStatePagerAdapter
instead of
public static class MyPagerAdapter extends FragmentPagerAdapter
Basically, FragmentPagerAdapter keeps the created Fragments in memory, while FragmentStatePagerAdapter destroys and creates them anew as they are shifted in and out of view.
Further Considerations:
1. Make sure you are not calling setRetainInstance(true) in any of your Fragments, else they won't be refreshed / updated.
2. Add
viewPager.setOffscreenPageLimit(0);
to your code. This ensures that adjacent Fragments are recreated.
3. Instead of
Activity -> ViewPager -> Fragments
create the structure as
Activity -> Fragment -> ViewPager -> Nested Fragments
This will ensure that each Fragment is refreshed on page swipe. See this post for the implementation.
EDIT:
As discussed in the comments below, point 2 is redundant. So only points 1 and 3 are actually useful in this case.