java.lang.IndexOutOfBoundsException: Invalid index 2, size is 1 你的数组大小只有1 ,你获取了下标 2 所以报错,你看看你的列表下标问题。 看你的错误应该在getView方法里面有问题。
数组越界不知道如何下手解决bug
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. 这个是listview的数据已经更新,但没有调用notifydatachange.数组越界的问题,不难解决,信息中没有定位哪一行,你就找listview中用到数组或者list的地方就是.
The content of the adapter has changed but ListView…这个异常是Adapter绑定的数据外部更新导致的,建议你把线程更新的数据源和适配器用的分离。 比如一个list数据,线程更新的是一个引用,当更新完该list,新建一个list,把更新好的list拷贝给这个新的list,把这个新的list给适配器的构造函数,用作listview的数据源,这样子线程更新数据源就不会报这个异常,就是增加了内存开销。
你的数组大小只有1 ,你获取了下标 2 所以报错,你看看你的列表下标问题。
看你的错误应该在getView方法里面有问题。
这个是listview的数据已经更新,但没有调用notifydatachange.数组越界的问题,不难解决,信息中没有定位哪一行,你就找listview中用到数组或者list的地方就是.
2.看提示来,listview没有及时更新
3.at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:225)
已经提示这个adapter出错了,仔细查查
比如一个list数据,线程更新的是一个引用,当更新完该list,新建一个list,把更新好的list拷贝给这个新的list,把这个新的list给适配器的构造函数,用作listview的数据源,这样子线程更新数据源就不会报这个异常,就是增加了内存开销。
这个挺好解决的吧