【发布时间】:2015-05-01 04:14:44
【问题描述】:
直觉上,我知道,当它抛出 IllegalStateException 时。但就我而言,我无法猜测,源头的问题在哪里。我敢说,麻烦线就在那里:
private class LoadMoreDataTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
if (isCancelled()) {
return null;
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
}
OFFSET = OFFSET + COUNT;
getWallsData();
return null;
}
@Override
protected void onPostExecute(Void result) {
mPostListAdapter.notifyDataSetChanged();
wallPostsList.onLoadMoreComplete();
super.onPostExecute(result);
}
@Override
protected void onCancelled() {
wallPostsList.onLoadMoreComplete();
}
有一条 logcat 消息:
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. [in ListView(2131099757, class com.costum.android.widget.LoadMoreListView) with Adapter(class android.widget.HeaderViewListAdapter)]
【问题讨论】:
标签: android listview illegalstateexception