Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

IllegalStateException when adding data from onScrolledToNextPage method without any delay #46

Closed
antunflas opened this issue Mar 17, 2017 · 0 comments · Fixed by #50
Closed

Comments

@antunflas
Copy link
Member

antunflas commented Mar 17, 2017

If RecyclerView has less items than it can maximum has visible (ie. RecyclerView can take 5 items on the screen, but adapter contains only 3 items) and it has set nextPageListener then IllegalStateException happens when adding next page without any delay.

Steps to reproduce:

  1. add RecyclerView, set nextPageListener and add just few items in adapter (to take less than recycler size)
  2. in onScrolledToNextPage add few more items (I used addAll method)

Workaround is to wrap code that is in onScrolledToNextPage into some runnable and post it on main handler.

Solution is to use main handler for posting task that would call nextPageListener.onScrolledToNextPage inside of onBindViewHolder method of MjolnirRecyclerAdapter.

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

Successfully merging a pull request may close this issue.

1 participant