ListView UI重绘时触发layoutChildren, 此时会校验listView的mItemCount与其Adapter.getCount是否相同,不同报错。
ListView.layoutChildren:

mItemCount是在父类AdapterView中定义的,package类型

在两个地方mItemCount会被赋值,初始设置Adapter时:
xxAdapter.notifyDataSetChanged时:
因此一定要确保修改adapter数据和notifyDataSetChanged是coupled出现的,否则在特定时序下很容易出现上述异常。
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification
原文:http://www.cnblogs.com/tonybright/p/4733734.html