Duo to the setCurrentItem() in ViewPager2, Changing currentItem is not allowed while fakeDragging
public void setCurrentItem(int item, boolean smoothScroll) {
if (isFakeDragging()) {
throw new IllegalStateException("Cannot change current item when ViewPager2 is fake "
+ "dragging");
}
setCurrentItemInternal(item, smoothScroll);
}
Duo to the setCurrentItem() in ViewPager2, Changing currentItem is not allowed while fakeDragging
So it's good to check fakeDragging state in the blow code(and also in other dotsIndicator types) before changing currentItem https://github.com/tommybuonomo/dotsindicator/blob/82d9884eda9634e6d9c89dccca05c6edc9afcb2c/viewpagerdotsindicator/src/main/kotlin/com/tbuonomo/viewpagerdotsindicator/SpringDotsIndicator.kt#L111-L115
And change code as Below