romandanylyk / PageIndicatorView

An page indicator for Android ViewPager
4.63k stars 564 forks source link

Bug in dynamicCount #109

Open hmaclean82 opened 5 years ago

hmaclean82 commented 5 years ago

when coming back to screen with viewpager, the initialisation of count does not work because the adapter is not yet linked to the viewpager and this code then results in fallback to DEFAULT_COUNT:

private int getViewPagerCount() {
        if (viewPager != null && viewPager.getAdapter() != null) {
            return viewPager.getAdapter().getCount();
        } else {
            return manager.indicator().getCount();
        }
    }
Phocacius commented 5 years ago

I had the same problem. Easy workaround: call setViewPager again in your fragments onResume method.