防止Adapter线程异常

创建时间:2018/10/2 10:50:33
关键字:adapter has changed but Listview did not receive a notification

报错信息

the content of the adapter has changed but Listview did not receive a notification.
Make sure the content of the adapter is not modified from a background thread,but only from the UI thread.
Make sure  your adapter calls notifyDatachanged() when its content changes.

解决方法

1.Adapter避免在子线程修改数据。

2.在主线程中更新数据后,及时调用notifyDataSetChanged。