Android Listview notifyDataSetChanged() 不起作用

bash 复制代码
private ArrayList<Map<String, String>> data = new ArrayList<Map<String, String>>();  
private ArrayList<Map<String, String>> delivered_data= new ArrayList<Map<String, String>>();  

如果直接将arraylist 的数据直接复制,无法完成更新

复制代码
data = delivered_data;
adapter.notifyDataSetChanged();

单个元素改变时候,可以更新

bash 复制代码
data.get(position).put("status", Select[0]);  //change the status 
adapter.notifyDataSetChanged();

如果要以数据list直接传递,需要用下面方法

bash 复制代码
 data.clear();
 data.addAll(delivered_data);
 adapter.notifyDataSetChanged();

更改listview用到下面项目中:

相关推荐
IT毕设实战小研3 小时前
基于大数据的国内主要农作物产量趋势分析与可视化
android·java·大数据·django·课程设计
企业数字化笔记4 小时前
固定资产历史数据怎么导入系统?Excel模板、字段映射和数据校验
android·java·数据库·后端
龙之叶4 小时前
Android出海系列-GMS认证介绍
android
潮族大Z4 小时前
Android性能优化:启动、内存、卡顿的一站式排查手册
android
事圆则缓6 小时前
从suspend字节码到 Retrofit 协程桥:挂起函数识别与恢复
android·retrofit
杉氧7 小时前
RN 性能调优指南:重渲染(Re-renders)控制与长列表(FlatList)优化
android·前端·react native
Coffeeee7 小时前
claude-video 一个让你的Agent拥有看视频能力的Skill
android·人工智能·aigc
菜鸟~noob2339 小时前
【电子战】第07篇:多普勒测向【含matlab代码】
android·开发语言·matlab
样子20189 小时前
Js 之根据白名单过滤 HTML(防止 XSS 攻击)
android·前端·javascript·html·xss
InsightCore9 小时前
别再往 Skill 里塞一切:我们如何重新思考 AI Debug Engineer
android·debug