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

相关推荐
二流小码农13 小时前
鸿蒙开发:router组件升级,彻底告别手动配置
android·ios·harmonyos
Digitally14 小时前
如何在安卓设备上使用 4 种简单方法将应用移动到 SD 卡
android
booboosui16 小时前
录一遍就会:8 种步骤、6 类失败,卡住时只修那一步
android
阿杰m16 小时前
Android源码第十五章:Camera2 与 CameraService——一帧图像怎样回到应用
android
恋猫de小郭1 天前
Flutter Analyzer 系列坑推进,必看,AI 时代这玩意最吃你内存
android·前端·flutter
LinXunFeng1 天前
拿竞品 App 一扫,技术栈全暴露了
android·flutter·开源
Gracker1 天前
AIW:从系统机制到性能排查,一本可以对照源码的 Android 电子书
android
三少爷的鞋1 天前
代码越来越便宜,判断力越来越贵:AI 时代的 Android 架构与协程避坑指南
android
Gracker2 天前
SmartPerfetto 1.19.0:换过分析引擎之后,这次更新了什么
android
HQL_seven2 天前
【Android】BroadcastReceiver 详解
android