android学习笔记:AndroidRuntime: java.lang.IllegalStateException: The content of the adapter has change
2014-03-05 17:52
519 查看
最近项目遇到一个bug,在没有通知adapter的情况下改掉了adapter的内容,但是问题的发生是在一个message传过来之后发生的,所以log里面完全没有自己代码的只言片语,在线程记录里面也没有打印出来主线程死掉的具体原因,只是说被block了。
如下:
AndroidRuntime: 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(2131362022,
class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
后来仔细看了下log报错信息,发现虽然没有具体的代码类信息,但是有一个很关键的点:
in ListView(2131362022, class android.widget.ListView 这里面的2131362022就是编译后生成的R文件中的编号信息。将2131362022转换成16进制,然后进入R文件搜索这个16进制的数,就可以定位到具体是哪一个ListView发生了这种异常,之后的问题就迎刃而解了。
如下:
AndroidRuntime: 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(2131362022,
class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
后来仔细看了下log报错信息,发现虽然没有具体的代码类信息,但是有一个很关键的点:
in ListView(2131362022, class android.widget.ListView 这里面的2131362022就是编译后生成的R文件中的编号信息。将2131362022转换成16进制,然后进入R文件搜索这个16进制的数,就可以定位到具体是哪一个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
- 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...的问题
- 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 receiv问题
- (转)java.lang.IllegalStateException: The content of the adapter has changed but
- 解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题
- 解决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
- 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
- java.lang.IllegalStateException: The content of the adapter has changed but ListView..
- 【转】解决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 receiv
- The content of the adapter has changed but ListView did not receive a notification,java.lang.IndexOu
- java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification