question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to update dotsIndicator adapter ?

See original GitHub issue

I don’t see any notifyDataSetChanged() method that updates items in dotsIndicator adapter ?

When i add new item in my main viewpager adapter my app get crash. See below logs

10.09.19 14:57
Version: 1.0.43 (1043tackTrace)
Thread[main,5,main]
Exception: java.lang.ArrayIndexOutOfBoundsException
Message: length=10; index=-1
Stacktrace:
	java.util.ArrayList.get(ArrayList.java:439)
	com.tbuonomo.viewpagerdotsindicator.SpringDotsIndicator$buildOnPageChangedListener$1.onPageScrolled$viewpagerdotsindicator_release(SpringDotsIndicator.kt:161)
	com.tbuonomo.viewpagerdotsindicator.OnPageChangeListenerHelper.onPageScrolled(OnPageChangeListenerHelper.kt:17)
	com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator$setViewPager$2$addOnPageChangeListener$1.onPageScrolled(BaseDotsIndicator.kt:218)
	androidx.viewpager.widget.ViewPager.dispatchOnPageScrolled(ViewPager.java:1930)
	androidx.viewpager.widget.ViewPager.onPageScrolled(ViewPager.java:1904)
	androidx.viewpager.widget.ViewPager.pageScrolled(ViewPager.java:1842)
	androidx.viewpager.widget.ViewPager.completeScroll(ViewPager.java:1988)
	androidx.viewpager.widget.ViewPager.scrollToItem(ViewPager.java:692)
	androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:670)
	androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
	androidx.viewpager.widget.ViewPager.dataSetChanged(ViewPager.java:1086)
	androidx.viewpager.widget.ViewPager$PagerObserver.onChanged(ViewPager.java:3097)
	androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:291)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
OwaisKhatricommented, Aug 2, 2021

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=10; index=-3 at java.util.ArrayList.get(ArrayList.java:439) at com.tbuonomo.viewpagerdotsindicator.DotsIndicator$buildOnPageChangedListener$1.onPageScrolled$viewpagerdotsindicator_release(DotsIndicator.java:107) at com.tbuonomo.viewpagerdotsindicator.OnPageChangeListenerHelper.onPageScrolled(OnPageChangeListenerHelper.java:22) at com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator$setViewPager$2$addOnPageChangeListener$1.onPageScrolled(BaseDotsIndicator.java:218)

I am still getting the same crash on 4.1.2. What could be the fix for that? @tommybuonomo

1reaction
manishpatelgtcommented, Sep 10, 2019

@tommybuonomo Yes it worked very well. Thanks for quick fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change the color of dots indicator (both active and ...
I've set the colors of the active and inactive states of the dot indicator using XML. However I am very confused as to...
Read more >
Material View Pager Dots Indicator - The Android Arsenal
This library makes it possible to represent View Pager Dots Indicator with 3 different awesome styles ! It supports ViewPager and ViewPager2.
Read more >
Dots Indicator for Viewpager made easy — Android! | Droid Log
Implementing seamless and smooth dots indicator for your custom viewpager component ... (3) Use DotsIndicator in your layout.xml ... imageViewPager.adapter?
Read more >
Image slider with dot Indicator in android studio - YouTube
In this video we are going to learn how to create image slider using viewpager2 with Indicators in android studioSubscribe the channel ...
Read more >
How to Implement ViewPager with Dotsindicator in Android?
Some of the attributes of the dots indicator are as follows- ... which come into action when we change the images in an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found