sergejsha / pinned-section-listview

Easy to use ListView with pinned sections for Android.
2.59k stars 808 forks source link

IndexOutOfBoundsException when rotating the device (when listview is empty) #18

Closed huahou closed 10 years ago

huahou commented 11 years ago

If the list view is empty (i.e., adapter does not have any items), IndexOutOfBoundsException is thrown when rotating the device.

The below line of code returns 0, while the adapter does not have any data. int firstVisiblePosition = getFirstVisiblePosition();

NicolasSiver commented 11 years ago

There is problem with onRestoreInstanceState in PinnedSectionListView. Add condition about item count in your adapter before call to the findCurrentSectionPosition method

sergejsha commented 10 years ago

Thanks! Changes were integrated.