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用到下面项目中:

相关推荐
程序员陆业聪1 小时前
AI编码提效实战:Skill、Rule与上下文工程
android
程序员陆业聪1 小时前
AI驱动需求梳理与Spec编写:让PRD自动变成技术方案
android
李艺为3 小时前
Android Studio使用switch匹配资源id时报需要常量表达式解决办法
android
YaBingSec5 小时前
玄机靶场-2024ccb初赛sc05 WP
android·运维·网络·笔记·安全·ssh
常利兵5 小时前
解锁Android嵌入式照片选择器,让你的App体验丝滑起飞
android
峥嵘life5 小时前
Android 切换用户后无法获取 MAC 地址分析解决
android·python·macos
JJay.5 小时前
Android BLE 为什么连上了却收不到数据
android
歪楼小能手5 小时前
Android16在开机向导最后添加一个声明界面
android·java·平板
夏沫琅琊5 小时前
Android联系人导入导出
android·kotlin
zh_xuan5 小时前
把Android Library 上传到github并在工程中引用该远程仓库
android·github·远程仓库