Callbacks For When A Fragment In A Viewpager Is Set As Current Page
I have a viewpager, it has 5 fragments page. I can switch between each fragment by tapping a navigation button. Now, what I'm trying to achieve is to refresh 1 of the page when ent
Solution 1:
Since you don't need any kind of caching, it's probably a good idea for you to use UPD: Thanks, Yarh, for pointing out that viewPager.setOffscreenPageLimit(0)
so pages won't be loaded in background, and onResume
will be called only when page is actually displayed.setOffscreenPageLimit(0)
doesn't work. Sorry for that.
If this doesn't work for you, use viewPager.addOnPageChangeListener(listener)
- onPageSelected(position)
method should help.
Post a Comment for "Callbacks For When A Fragment In A Viewpager Is Set As Current Page"