HeaderListView
HeaderListView copied to clipboard
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
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
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...
Hello,
inside Headerlistview boolean prevHasRows = mAdapter.numberOfRows(actualSection - 1) > 0; Replace boolean prevHasRows = mAdapter.numberOfRows(actualSection ) > 0;
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)