I found out the problem: the adapter uses the id of the container together with the position in the adapter to generate a tag. This tag is then used to determine if a fragment already exists in the FragmentManager. The solution is to make the ids of the four containing fragments unique. On Sep 14, 2012 7:30 PM, "Jethro Borsje" <[email protected]> wrote:
> Hi fellow devs, > > I'm building an app using the v4 support library. My app has an activity > which contains a grid of 4 ViewPagers ( > http://developer.android.com/reference/android/support/v4/view/ViewPager.html) > which in turn contain 3 fragments through which the user can swipe. My > problem is that each of the 3 fragments inside the ViewPagers is > instantiated exactly once instead of once per ViewPager (i.e. 3 fragment > instances instead of 12). For example: in the screenshot bellow I would > expect 3 instances of the TableFragment and one instance of the > BarChartFragment but I get only one instance of the TableFragment and one > instance of the BarChartFragment. I feel this is a bug in the support > library, does anybody know if this is the case or might something else be > wrong? > > Best regards, > Jethro Borsje > > http://www.jborsje.nl > > > <https://lh6.googleusercontent.com/-rbUJyg2qimc/UFNng6GfaCI/AAAAAAAAQOM/3rh8nLmdkEs/s1600/tablet-ui.png> > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

