ViewPager.setOffscreenPageLimit(0) doesn't work as expected
Like the question. But I need a custom Viewpager which load one page on time. Is there any example?
ViewPager.setOffscreenPageLimit(0) doesn't work as expected
Like the question. But I need a custom Viewpager which load one page on time. Is there any example?
Yes you can do this with following steps
count variable in the adapter classViewPager Adapter make a public function say setCount()getCount() function of Adapter return the count
variableoverride the on pageScroll() function of the ViewPager when the
user flips the page you can call the setCount() to increase the count
of the count variableindex is last and page is
scrolled to leftthis should work .
Depending on what you want to achieve (if it is just about saving memory or lowering loading time), you can also load all pages as usual but load the content of the fragment only when it actually gets displayed.