In calculateSections method, the getSectionCount is called twice: the first time to populate mSections list and the second time to calculate mSectionIndices. This is working fine in case the whole work is done in one thread.
In my case, I had a big number of data to work on and I used several threads to do so and after finishing working on a section, I call the if the notifySectionDataSetChanged to be executed on the UI thread.
In some cases, if the work on the other threads is being processed faster than the UI thread, the values returned by getSectionCount between the first call and the second one, are different:
In calculateSections method, the getSectionCount is called twice: the first time to populate mSections list and the second time to calculate mSectionIndices. This is working fine in case the whole work is done in one thread.
In my case, I had a big number of data to work on and I used several threads to do so and after finishing working on a section, I call the if the notifySectionDataSetChanged to be executed on the UI thread.
In some cases, if the work on the other threads is being processed faster than the UI thread, the values returned by getSectionCount between the first call and the second one, are different:
I fixed this by calling the getSectionCount only once.