ListView/Adapter IllegalStateException
来源:互联网 发布:淘宝海关拍卖车 编辑:程序博客网 时间:2024/05/16 07:52
今天遇到这个问题: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.
是不是你在用 adapter.notifyDataSetChanged() 刷新listview的时候,如果当前listview还未来得及刷新,你就去触摸listview,就会导致跳出出错信息呢?
解决办法是,通过设置listview.setVisibility(View.VISIBLE/View.GONE)。
在 adapter.notifyDataSetChanged() 之前调用listview.setVisibility(View.GONE);在adapter.notifyDataSetChanged() 之后调用listview.setVisibility(View.VISIBLE)
我个人觉得是因为数据变化了,你确没有通知listview更新,因此错误。
下面是找到的两个网址,大家可以参考。
http://stackoverflow.com/questions/3132021/android-listview-illegalstateexception-the-content-of-the-adapter-has-changed
http://www.eoeandroid.com/thread-22292-1-1.html
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- ListView/Adapter IllegalStateException
- 解决java.lang.IllegalStateException ( ListView adapter)
- ListView IllegalStateException
- ListView IllegalStateException
- Android, ListView IllegalStateException: “The content of the adapter has changed but ListView did no
- .IllegalStateException:The content of the adapter has changed but ListView did not receive a notific
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- 解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive
- python升级
- SQL SERVER 2005如何建立自动备份的维护计划
- Visual Studio2010快捷键
- Android动画效果Animation之Tween实现简单动画
- cppcheck c++静态代码检查
- ListView/Adapter IllegalStateException
- Matlab连接字符串用strcat好,还是用 [ ] 好
- Linux复习总结
- JS获取事件源对象
- PHP与MYSQL
- U-boot移植介绍
- admin5.com中的程序模板运用
- 【翻译】Ant常用任务1-解压缩任务
- HTML5学习资源