XListView下拉刷新的问题

请叫我周周周 2016-03-09 11:49:10
报错:
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. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131034293, class com.gaokao.ppst.utils.XListView) with Adapter(class android.widget.HeaderViewListAdapter)


onRefresh()的代码:

@Override
public void onRefresh() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
URL = "http://10.230.17.157:8080/yygk/SetNewsList";
new NewsListLoadMore().execute(URL);//这里执行异步操作的
onLoad();
}
}, 2000);
}


这里是AsyncTask中onPostExecute中的代码,在这里更新adapter
if (mAdapter == null) {
mAdapter = new TabNewsListViewAdapter(mContext, result);
mNewsListView.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
} else {
mAdapter.onDateChange(result);
mAdapter.notifyDataSetChanged();
}

求大神帮忙看看那里出了问题
还有一个问题是,上面我的更新时间是定的2秒,怎么异步加载时间呢?
...全文
171 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
h1324694009 2016-03-14
  • 打赏
  • 举报
回复
线程里面不可以更新UI中的view

80,490

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧