Skip to content Skip to sidebar Skip to footer

Fragments In Viewpager - Wrong Index?

I'm using a ViewPager to display 3 ListFragments of the same class, but the ListView content of each Fragment should be different depending on Fragment's index. ListFragment:

Solution 1:

ViewPager creates nearest items for swipe animation purpose. So first time when activity attaches ViewPager user should see first fragment and can swipe to second one. When user swiped ViewPager creates third one and user can swipe again.

  1. attachment of ViewPager
  2. ViewPager creates first and second items - user see first fragment
  3. swipe begin - user see transition between first and second
  4. swipe end - user see second fragment
  5. ViewPager creates third item
  6. swipe begin - user see transition between second and third
  7. swipe end - user see third fragment
  8. ViewPager destroys first fragment and create fourth
  9. etc

Post a Comment for "Fragments In Viewpager - Wrong Index?"