Reputation: 2979
i have some strange behavior with the content of a fragment. I created an app with swipeable tab menu, total 4 fragments/tabs.
On the fourth fragment, i add content (TextViews) programmatically, according to 2 spinner on the top of the fragment. So when you choose a value of one of the spinner, the content (inside a LinearLayout) is being replaced with new generated TextViews.
Everything is working nice, BUT: When both spinner are on the first value (and just there), the content disapears when i swipe to another fragment and come back to the fourth fragment. After selecting another value from one of the spinners, the content is being generated as normal, also when i select the first values again. When i swipe the first time to the fourth fragment, i see the content.
Any hint?
Upvotes: 2
Views: 59
Reputation: 3357
Looks like your states of the fragments are not saved correctly. Try setting:
myViewPager.setOffscreenPageLimit(4);
Upvotes: 1