ViewPager is a Layout manager that allows the user to flip left and right through pages of data. It is most often used in conjunction with Fragment, which is a convenient way to supply and manage the lifecycle of each page.
One important thing to note about ViewPager usage is that there are two different versions of both FragmentPagerAdapter
and FragmentStatePagerAdapter
.
If you are using android.app.Fragment
native Fragments with a FragmentPagerAdapter or FragmentStatePagerAdapter, you need to use the v13 support library versions of the adapter, i.e. android.support.v13.app.FragmentStatePagerAdapter
.
If you are using android.support.v4.app.Fragment
support library Fragments with a FragmentPagerAdapter or FragmentStatePagerAdapter, you need to use the v4 support library versions of the adapter, i.e. android.support.v4.app.FragmentStatePagerAdapter
.