码迷,mamicode.com
首页 > 移动开发 > 详细

Android报错:The content of the adapter has changed...与Channel is unrecoverably broken and will be disposed的分析与解决办法

时间:2015-08-28 15:00:14      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

在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("")

解决:

找到导致问题的地方,先做判断再传值。

Android报错:The content of the adapter has changed...与Channel is unrecoverably broken and will be disposed的分析与解决办法

标签:

原文地址:http://www.cnblogs.com/homg/p/4766272.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!