java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification
ListView UI重绘时触发layoutChildren, 此时会校验listView的mItemCount与其Adapter.getCount是否相同,不同报错。
ListView.layoutChildren:
mItemCount是在父类AdapterView中定义的,package类型
在两个地方mItemCount会被赋值,初始设置Adapter时:
![](https://images0.cnblogs.com/blog2015/341906/201508/161025134103834.png)
xxAdapter.notifyDataSetChanged时:
![](https://images0.cnblogs.com/blog2015/341906/201508/161026068957393.png)
因此一定要确保修改adapter数据和notifyDataSetChanged是coupled出现的,否则在特定时序下很容易出现上述异常。