I have the next scenario
An activity with a FrameLayout. In the FrameLayout I load fragments using replace
android.support.v4.app.Fragment contentToLoad = null;
android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
...get the proper fragment depending of some logic
contentToLoad = new FragmentDemoContent();
fragmentTransaction.replace(R.id.fl_contentcontainer, contentToLoad);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
One of the fragments contains a ViewPager and a SlidingTabLayout (Copied from https://github.com/codepath/android_guides/wiki/Google-Play-Style-Tabs-using-SlidingTabLayout)
Inside the ViewPager I'm loading as pages other fragments, each fragment is a WebView that load a local content from assets. The adapter extends FragmentPagerAdapter
When I first load this fragment everything works fine, and I can swipe and load all the pages. But If I load other fragment and I came back to load the fragment with the ViewPager again, I get random blank pages, sometimes is the first one, sometime others. Sometimes also when I swipe back the previous blank page appears, but not always
I have tried, with no luck:
- Check if its a WebView problem. It is not, using instead of the fragments with the webviews blank default fragments with simply a textview, I get the random blank pages too.
- Invalidate the views, the pager... after each scroll or page changed
- This approach ViewPager PagerAdapter not updating the View
- Set http://developer.android.com/reference/android/support/v4/view/ViewPager.html#setOffscreenPageLimit%28int%29 to load all the pages
Any ideas or something that we can try?