处理The content of the adapter has changed but ListView did not receive a notification异常
2014-01-10 15:00
441 查看
istView在更新时报异常:
ERROR/AndroidRuntime(15260): 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(2131099657, class android.widget.ListView) with Adapter(class com.pocketdigi.pptheater.ListAdapter)]
网上有很多蛋疼或者治标不治本的解决方法,其实解决方法很简单:
1.如何你使用线程处理的后台数据,那么就在run方法里面用Handler将数据send出来到主线程里面的handleMessage然后再addAll或者赋值;
2.如果用的异步task,那么在onPostExecute里面去add或者赋值就ok了,注意千万不要在后台去修改类变量的方式去修改数据;
ERROR/AndroidRuntime(15260): 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(2131099657, class android.widget.ListView) with Adapter(class com.pocketdigi.pptheater.ListAdapter)]
网上有很多蛋疼或者治标不治本的解决方法,其实解决方法很简单:
1.如何你使用线程处理的后台数据,那么就在run方法里面用Handler将数据send出来到主线程里面的handleMessage然后再addAll或者赋值;
2.如果用的异步task,那么在onPostExecute里面去add或者赋值就ok了,注意千万不要在后台去修改类变量的方式去修改数据;
相关文章推荐
- 处理The content of the adapter has changed but ListView did not receive a notification异常
- 处理The content of the adapter has changed but ListView did not receive a notification异常
- 处理The content of the adapter has changed but ListView did not receive a notification异常
- 处理The content of the adapter has changed but ListView did not receive a notification异常
- The content of the adapter has changed but ListView did not receive a notification 异常解析
- The content of the adapter has changed but ListView did not receive a notification 异常解决方案
- 异常 The content of the adapter has changed but ListView did not receive a notification可能的一种解决方法
- The content of the adapter has changed but ListView did not receive a notification 异常解决
- 异步加载Listview The content of the adapter has changed but ListView did not receive a notification
- The content of the adapter has changed but ListView did not receive a notification
- android报The content of the adapter has changed but ListView did not receive a notification的解决方案
- The content of the adapter has changed but ListView did not receive a notification
- 【Android策略】The content of the 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 co
- The content of the adapter has changed but ListView did not receive a notification
- (ListView使用错误)The content of the adapter has changed but ListView did not receive anotification
- The content of the adapter has changed but ListView did not receive a notification.
- The content of the adapter has changed but ListView did not receive a notification
- .解决bug:The content of the adapter has changed but ListView did not receive a notification .
- The content of the adapter has changed but ListView did not receive a notification 错误的解决方案