java.lang.IllegalStateException: The content of the adapter has changed but

来源:互联网 发布:慧思达软件多少钱 编辑:程序博客网 时间:2024/06/05 08:57
发现一个有时候会出现的错误:
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(2131165196, class android.widget.ListView) with Adapter(class com.jovision.multiscreen.views.DeviceScanSelectDialog$DeviceAdapter)
需要data.addAll,Adapter.notifyDataSetChanged()在主线程执行,
data.addAll(data_update);
if
(data_update_size<20){
   
mListView.setPullLoadEnable(false);
}else{
   
mListView.setPullLoadEnable(true);
}
onLoad()
;
mAlertAdapter.notifyDataSetChanged();
0 0