报错信息: ERROR/AndroidRuntime(302): 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(2131034114, class android.widget.ListView) with Adapter(class com.isoftstone.adapter.MainListViewAdapter)]通过多线程发送Handle发送消息
代码:
Message msg = new Message();
msg.what = 1;
handle.sendMessage(msg); // 更新adapter
adapter.notifyDataSetChanged();
代码:
Message msg = new Message();
msg.what = 1;
handle.sendMessage(msg); // 更新adapter
adapter.notifyDataSetChanged();
adapter.notifyDataSetChanged();Make sure the content of your adapter is not modified from a background thread, but only from the UI thread更新adapter 只能在UI线程中更新,即主线程中