tinkoff-mobile-tech / ScrollingPagerIndicator

Pager indicator inspired by Instagram. Lightweight and easy to set up.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

overflow Integer.MAX_VALUE

alvinrxg opened this issue · comments

Hi, i tried once with recyclerView and in its adapter i set the itemCount to

        @Override
        public int getItemCount() {
            return Integer.MAX_VALUE;
        }

Then it crashes because of OutOfMemoryError

    java.lang.OutOfMemoryError: float[] of length 2147483647 would overflow
        at ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator.initDots(ScrollingPagerIndicator.java:464)
        at ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator.setDotCount(ScrollingPagerIndicator.java:324)
        at ru.tinkoff.scrollingpagerindicator.RecyclerViewAttacher.attachToPager(RecyclerViewAttacher.java:111)
        at ru.tinkoff.scrollingpagerindicator.RecyclerViewAttacher.attachToPager(RecyclerViewAttacher.java:13)
        at ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator.attachToPager(ScrollingPagerIndicator.java:251)
        at ru.tinkoff.scrollingpagerindicator.ScrollingPagerIndicator.attachToRecyclerView(ScrollingPagerIndicator.java:219)

Though it's minor issue, there would be any chance to have such many items. 😁

Hi!
Thank you for report. This issue was fixed in #12.

Fixed in version 1.0.6.