在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("")
解決:
找到導致問題的地方,先做判斷再傳值。