If app:piv_dynamicCount="true" is set, we register a DataSetObserver on the PagerAdapter of the ViewPager to get notified of data changes and update the page count accordingly.
If however the PagerAdapter changes later on, we don't re-register on the new PagerAdapter and thus fail to update the page count for future data set changes of the ViewPager.
Solution
Re-register the DataSetObserver whenever the PagerAdapter changes.
Problem
If
app:piv_dynamicCount="true"
is set, we register aDataSetObserver
on thePagerAdapter
of theViewPager
to get notified of data changes and update the page count accordingly. If however thePagerAdapter
changes later on, we don't re-register on the newPagerAdapter
and thus fail to update the page count for future data set changes of theViewPager
.Solution
Re-register the
DataSetObserver
whenever thePagerAdapter
changes.