使用了AsyncTask在后台刷新适配器,并且通知ui线程更新ListView,运行时发现时不时的出现 如题 的错误,

导致程序崩溃,解决方法如下:

1.建立一个缓冲数据集,这个数据集就是填充适配器的数据集,如ArrayList<String>

2.在AsyncTask的后台方法(doInBackground)中将数据添加至缓冲数据集中,然后调用onProgressUpdate通知更新

3.在onProgressUpdate方法中,将缓冲数据集的数据添加至原数据集中,然后将缓冲数据集中的数据清空

注意:访问缓冲数据集的时候,需要加上同步锁 synchronized

android The content of the adapter has changed but ListView did not receive a notification 错误的解决方案的更多相关文章

  1. Android The content of the adapter has changed but ListView did not receive a notification终极解决方法

    这几天做一个自动扫描SD卡上所有APK文件的小工具,扫描过程中会把APK添加到LISTVIEW中显示,结果出现以下错误:(有时候触摸更新数据时候,触摸listview也会报错) E/AndroidRu ...

  2. Android The content of the adapter has changed but ListView did not receive a notification

    The content of the adapter has changed but ListView did not receive a notification. Make sure the co ...

  3. Android开发-- The content of the adapter has changed but ListView did not receive a notification - With AsyncTask

    最近在联系开发DaysMatter时遇到一个问题: app中使用ListView来展示所有事件,每次添加完事件后使用下面代码来更新ListView. toDoListView.refreshDrawa ...

  4. ListView:The content of the adapter has changed but ListView did not receive a notification终极解决方法

    使用ListView时遇到如下的异常信息: 10-26 18:30:45.085: E/AndroidRuntime(7323): java.lang.IllegalStateException: T ...

  5. The content of the adapter has changed but ListView did not receive a notification

    java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive ...

  6. java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification

    ListView UI重绘时触发layoutChildren, 此时会校验listView的mItemCount与其Adapter.getCount是否相同,不同报错. ListView.layout ...

  7. 问题解决:The content of the adapter has changed but ListView did not receive a notification

    1. 不要在后台线程中直接调用adapter 2. 不要在后台线程中修改adapter绑定的数据 如果对adapter或者adapter绑定的数据是在线程中,加上runOnUiThread就可以了 r ...

  8. 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. Make s

    我出现这个问题是引用资源文件问题 helper.getView(R.id.in_pic).setBackgroundResource(item.getResourceId()); //错的helper ...

  9. 【转】解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题

    原文网址:http://blog.csdn.net/ueryueryuery/article/details/20607845 我写了一个Dialog,Dialog中有一个ListView,想要点Li ...

随机推荐

  1. css实现鼠标滑过出现从中间向两边扩散的下划线

    这个效果一开始我是在华为商城页面上看到的,刚开始还以为挺复杂,实现的时候还有点没头绪.不过,还好有百度,借此记录一下我在导航条上应用的实现方法. 主要是借助了伪元素,代码如下: <div cla ...

  2. 使用zap接收gin框架默认的日志并配置日志归档

    目录 使用zap接收gin框架默认的日志并配置日志归档 gin默认的中间件 基于zap的中间件 在gin项目中使用zap 使用zap接收gin框架默认的日志并配置日志归档 本文介绍了在基于gin框架开 ...

  3. 60秒定位问题,十倍程序员的Debug日常

    作者:陶建辉 这是我在 2020 年 5 月写的一篇内部博客,当时是希望研发和技术支持同学能够帮助用户快速定位 Bug,解决问题.2020 年 12 月我又迭代了一版,并还针对此进行了内部的培训.这段 ...

  4. JS逆向-抠代码的第二天【手把手学会抠代码】

    今天的学习项目:沃支付:https://epay.10010.com/auth/login 清空浏览器缓存后,打开网页,输入手机号,密码222222,按照网站要求填入验证码(sorry,我没有账号密码 ...

  5. MySQL按天备份二进制日志

    #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:guozhen.zhang     import MySQLdbimport timeimp ...

  6. (2)MySQL进阶篇SQL优化(show status、explain分析)

    1.概述 在应用系统开发过程中,由于初期数据量小,开发人员写SQL语句时更重视功能上的实现,但是当应用系统正式上线后,随着生产数据量的急剧增长,很多SQL语句开始逐渐显露出性能问题,对生产环境的影响也 ...

  7. 采用React + Fabric + ImageMagick 实现大图片DIY定制

    一,需求背景: 某个印刷公司,有一系列的设计文件模板.接到客户订单时,就在这些设计文件模板上,做一些简单的定制,就能够满足客户的印刷需求. 如在设计文件模板上添加客户的Logo,二维码,联系方式等. ...

  8. P1540_机器(JAVA语言)

    题目背景 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 题目描述 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先 ...

  9. 错误提示:Access denied for user 'GC'@'localhost' (using password: YES)

    错误描述:使用的是C3P0连接池 Spring整合Mybatis时出现错误 java.sql.SQLException: Access denied for user 'GC'@'localhost' ...

  10. Ubuntu-搭建Clang Static Analyzer环境

    其实也就是一个开源的漏洞扫描器 专门扫描C/C++ 0BJECT-C++这种,实不相瞒我搭建了5天这个环境,最后我发现了一种超级方便的办法 前面怎么走的坑还是不分享了吧,由于没有看到前面很多人的办法或 ...