Navdroid
Navdroid

Reputation: 1549

Using ViewPager with sliding Screen always getting 5 pages?

I am using ViewPager with sliding Screen as given here : http://developer.android.com/training/animation/screen-slide.html.

But I am always getting five pages even I have changed NUM in Activity .But still it is only displaying five pages. Is there any limit to this . If yes how could I overcome this problem I need to show around 20 pages of this?

Please help ?

Upvotes: 0

Views: 272

Answers (1)

Zoubiock
Zoubiock

Reputation: 1165

private static final int NUM_PAGES = 5;

private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
    public ScreenSlidePagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return new ScreenSlidePageFragment();
    }

    @Override
    public int getCount() {
        return NUM_PAGES;
    }
}

Your adapter is always returning 5 to getCount method. Just change that with the size of your collection

Upvotes: 1

Related Questions