I have a common problem:
java.lang.IllegalStateException: The content of the adapter has changed but List
View did not receive a notification. Make sure the content of your adapter is no
t modified from a background thread, but only from the UI thread. [in ListView(2
131427573, class android.widget.ListView) with Adapter(class android.widget.Head
erViewListAdapter)]
But the adapter is not my code, but in android.widget.HeaderViewListAdapter
It uses Jellybean.
I read the source code HeaderViewListAdapter, ListAdapterand ListView. IllegalStateExceptioncalled when the number of items in is ListViewnot equal to the number provided ListAdapter. In this case, ListAdapteris HeaderViewListAdapter. The counter HeaderViewListAdapteris the source counter ListAdaptertransmitted by the client code, plus the size of the header and footer.
I have drawn my code. All access to ListViewis in the user interface thread, and it always follows notifyDataSetChanged(). I use one footer.
This does not occur under normal use. Is it because of the monkey? But how can Monkey change my variables from other threads?
- Update after testing Monkey
I deleted the footer by deleting the call addFooterView(). The exception is the monkey. Should I delete the call in addFooterView()at some point?
source
share