Hopefully someone can help me with a slight problem/confusion I have with Viewpagers and saving data.
PROBLEM:
When scrolling across the four views I have,
Instead of saving the state of those pages you could modify your ViewPager so it buffers all of your pages instead of destroying them and recreating them when you scroll.
So for example if you have 4 pages:
ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
pager.setOffscreenPageLimit(3); // the number of "off screen" pages to keep loaded each side of the current page
pager.setAdapter(new PageAdapter(context));
Now your pages will be kept 'alive'
Be careful with this technique however because it will increase memory consumption. The number passed to setOffscreenPageLimit() is the number of pages each side of the current page to retain. In this case we have 4 pages in total so the worst case scenario is when we are at the far edge of of the page set - we have the currently visible page and then the remaining 3 pages are off screen to one side and are thus kept in memory. However, with a larger data set it could potentially mean 7 pages are kept in memory (current page plus 3 either side).
Generally the more optimal solution would be to properly deal with unloading and reloading the page state and re-render them.
Hope this helps