防止Adapter线程异常

作者:陆金龙    发表时间:2018-10-02 10:50   


报错信息

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。