HeaderListView icon indicating copy to clipboard operation
HeaderListView copied to clipboard

java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1

Open nileshpambhar opened this issue 7 years ago • 2 comments

Hello,

When i have bind listview with real data. i am getting below error. with out scrolling listview it is working fine. but once i scroll page then its crash app.

Please check screenshot screenshot

java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 at java.util.ArrayList.get(ArrayList.java:310) at com.applidium.headerlistviewdemo.DemoActivity$1.numberOfRows(DemoActivity.java:43) at com.applidium.headerlistview.HeaderListView$HeaderListViewOnScrollListener.onScroll(HeaderListView.java:151)

Please check my code...

DemoActivity.txt

nileshpambhar avatar Mar 22 '17 06:03 nileshpambhar

Hello,

inside Headerlistview boolean prevHasRows = mAdapter.numberOfRows(actualSection - 1) > 0; Replace boolean prevHasRows = mAdapter.numberOfRows(actualSection ) > 0;

HiteshRaviya avatar Mar 22 '17 06:03 HiteshRaviya

There is actually a lot of errors with calls with section -1. For example to hasSectionHeaderView(section)

Another critical one if handling multiple headers with different sizes is the need to add:

            if (actualSection < 0)
                actualSection = 0;

To addSectionHeader(int actualSection)

mortenholmgaard avatar Jul 17 '17 17:07 mortenholmgaard