Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nileshpambhar opened this issue Mar 22, 2017 · 2 comments
Open

Comments

@nileshpambhar
Copy link

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

@HiteshRaviya
Copy link

Hello,

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

@mortenholmgaard
Copy link

mortenholmgaard commented Jul 17, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants