Android报错:The content of the adapter has changed...与Channel is unrecoverably broken and will be disposed的分析与解决办法
2015-08-28 13:28
726 查看
在Android中adapter错误:
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。
分析:
这个错误通常是listview等控件在使用adapter适配数据时可能传入的是一个静态的list,而在adapter中直接使用=号来赋值,当外部这list被改变(如多线程操作了这个list)后没有及时的调用adapter的notifyDataSetChanged,导致下次来更新的时候报错。
解决:
在adapter中不要直接用=号来赋值,使用如下两种方法重新分配内存:
1:list.clear ,list.addall。
2:arraylist.clone。
------------------------------------------------------------------------
Android错误:Channel is unrecoverably broken and will be disposed!
分析:
在使用某些方法时传入的参数有问题或格式错误。如:Integer.parseInt("")
解决:
找到导致问题的地方,先做判断再传值。
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。
分析:
这个错误通常是listview等控件在使用adapter适配数据时可能传入的是一个静态的list,而在adapter中直接使用=号来赋值,当外部这list被改变(如多线程操作了这个list)后没有及时的调用adapter的notifyDataSetChanged,导致下次来更新的时候报错。
解决:
在adapter中不要直接用=号来赋值,使用如下两种方法重新分配内存:
1:list.clear ,list.addall。
2:arraylist.clone。
------------------------------------------------------------------------
Android错误:Channel is unrecoverably broken and will be disposed!
分析:
在使用某些方法时传入的参数有问题或格式错误。如:Integer.parseInt("")
解决:
找到导致问题的地方,先做判断再传值。
相关文章推荐
- 如何让EditText的光标置于Text的尾部
- Android Migrate Android Code
- Universal Image Loader使用文档
- Android 使用url获取数据时的文字编码问题
- meta-data in the Android
- Android 混淆代码总结
- AsyncTask of Android Android系统中的异步任务
- Android用ImageView显示本地和网上的图片
- Android(java)学习笔记199:Android中View动画(Tween Animation)
- Android中使用AIDL时的跨进程回调—Server回调Client
- Android学习之远程绑定调用service
- Android Service学习之本地服务
- Android service
- Android中的Intent(意图)的使用
- android zxing
- android中padding和 margin区别
- Android杂记
- Android 学习历程摘要(五)
- android菜鸟进阶之路——使用通知(通知的基本运用)
- android菜鸟进阶之路——布局的加载(父布局与子布局有先后顺序)