博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android Exception 6 (adapter is not modified from a background thread)
阅读量:7030 次
发布时间:2019-06-28

本文共 572 字,大约阅读时间需要 1 分钟。

07-23 09:47:34.962: E/AndroidRuntime(7001): 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(2131230794, class com.tongyan.widget.view.PullToRefreshListView) with Adapter(class android.widget.HeaderViewListAdapter)]

这个问题出现的场景是,在同一个Activity中,既使用了Thread,并且使用了AsyncTask

网上找来的:

1.改变适配器Adapter内容时不要在后台线程中,必须在UI线程中处理,这点可以通过Handler传出来解决。

2.尝试Adapter的notifyDataSetChanged()方法,当然主要看你代码的具体情况。

 

转载地址:http://lugxl.baihongyu.com/

你可能感兴趣的文章
java.net.ProtocolException: Exceeded stated content-length of: '13824' bytes
查看>>
asp.net 连接 oracle10g 数据库
查看>>
C 入门 第十一节
查看>>
HTML简单的注册页面搭建
查看>>
【06】Vue 之 组件化开发
查看>>
Docker 安装
查看>>
多数据库数据导入
查看>>
[AVR]高压并行编程---基础知识
查看>>
inl文件介绍
查看>>
前端坑--表单篇
查看>>
P2P原理基础
查看>>
完成登录功能,用session记住用户名
查看>>
DBCP和C3P0使用--未完善
查看>>
JS常用方法(获取Class、获取元素样式、事件监听、cookie、ajax等)
查看>>
BZOJ 1084 最大子矩阵
查看>>
2018杭电多校第三场1007(凸包,极角排序)
查看>>
django中orm的简单操作
查看>>
Mybatis知识(1)
查看>>
[CentOS] 7 不执行文件 /etc/rc.d/rc.local
查看>>
模态窗口的各个属性
查看>>