Yet again that java.lang.IllegalStateException occurs with "The content of the adapter has changed but ListView did not receive a notification".
Looking on the platform source, I see the following:
This is thrown in the ListView.layoutChildren() when adapter's getCount() is not equal to AdapterView<>.mItemCount.
AdapterDataSetObserver in an inner class of AdapterView<>, it assigns the AdapterView<>.mItemCount in own method onChanged() taking the value from the adapter (AdapterView.java:778).
An AdapterDataSetObserver instance is AbsListView.mDataSetObserver, created in ListView.setAdapter()
Where that onChanged() called from? It need to be called before the adapter starts reportn the new count number. I see it's called only on some header/footer adds and removes in the ListView class.
mDataSetObservable is created in BaseAdapter and notifyDataSetChanged() passed to it.
Assuming those objects are related, I just need to change the data in adapter in the UI thread on completion and then call notifyDataSetChanged()