0
logcat中的:ListView控件不通知適配器改變
06-28 22:21:11.031: E/AndroidRuntime(1282): 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(16908298, class android.widget.ListView) with Adapter(class android.widget.ArrayAdapter)]
代碼:
protected void onPostExecute(Void v) {
items.add(NewItem);
Collections.sort(items);
adapter.notifyDataSetChanged();
}
問:我在哪裏,我想也更新的ListView?
在此發佈您的doInBackground方法代碼。你只能在onPostExecute中更新listview。我已在下面發佈了我的代碼,該代碼非常完美 – Nirali
您的代碼是我所需要的。完善! – KickingLettuce
我做到了。等待時間過去了。再次感謝。 – KickingLettuce