Closed ghost closed 7 years ago
Can you provide a simple demo project that can reproduce your issue?
@jaychang0917 I've posted an example showing the same issue at https://github.com/csimmonsbluebook/SimpleRecyclerViewTest
@csimmonsbluebook You should call setupRecyclerViewHeaders();
in on onCreate
@jaychang0917 That still didn't fix the issue when refreshing the recyclerView. After refreshing, it still creates the extraneous section and cells.
@csimmonsbluebook what's your new code? pls update https://github.com/csimmonsbluebook/SimpleRecyclerViewTest
@jaychang0917 Sorry I moved the wrong method call. But moving setupRecyclerViewHeaders();
to onCreate
caused a NullPointerException
for me. I just pushed the code
@csimmonsbluebook I just released a new version, pls try 1.1.17
@jaychang0917 Your fix in 1.1.17
worked. Thanks for the help and quick responses!
When I hit a refresh button in my app to reload the SimpleRecyclerView with section headers, I use an AsyncTask to get the data to create the sections and cells. I run the .removeAllCells() onPreExecute, create the cells in the doInBackground, and add the cells to the recylerView in the onPostExecute. However, the recyclerView seems to do some sort of caching and adds an extraneous section to the beginning and then adds an extraneous cell to the end of each section after each refresh.
I've added images below for reference:
On initial load...
After first refresh...
After second refresh...
You can see the pattern, and it continues with each refresh. Any thoughts on how to solve this issue? Thanks