java.lang.IllegalStateException : the content of the adapter has changed but ListView did not receive a notification.
后面还有一大堆解释,意思就是要在主线程更新Adapter
这个问题的出现并不是一直存在,也就是说在运行了一段时间 上拉加载更多的listView数据时,偶尔出现,但在比较快的操作下就出现;
看错误提示,开始把所有的数据更新都放入主线程
后面发现原因在下面这段代码中,currentStories是adapter中的数据,再改变这段数据的时候也把他放到主线程中,这样就不会再出现这个问题了。
if(currentStories != null){
NewsInfo date = new NewsInfo();//添加一个时间item
date.setType(10);
date.setTitle(dateId);
currentStories.add(date);
currentStories.addAll(beforeNewsInfo.getStories());
}
//更新文本数据部分
runOnUiThread(new Runnable() {
public void run() {
newsListViewAdapter.notifyDataSetChanged();
}
});