报错:
onRefresh()的代码:
这里是AsyncTask中onPostExecute中的代码,在这里更新adapter
求大神帮忙看看那里出了问题
还有一个问题是,上面我的更新时间是定的2秒,怎么异步加载时间呢?
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秒,怎么异步加载时间呢?