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

相关推荐
年小个大7 小时前
受 go-zero 启发,我给 Flutter 写了一套 CLI 脚手架
android·flutter·架构
Android-Flutter8 小时前
为什么说ActivityThread是主线程?
android·kotlin
余额瞒着我当琳10 小时前
C++模板初阶与STL初探
android·java·c++
知行合一。。。12 小时前
DeepAgents--01--Agent和OpenClaw的相关概念
android·数据库
汪海游龙13 小时前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
weixin_4407841114 小时前
【IntentSeivice实现原理】
android·java·开发语言·intentservice
delta_hell14 小时前
【阅读源码--Android】动画之ValueAnimator--2
android·源码·valueanimator
delta_hell14 小时前
【阅读源码--Android】动画之辅助类
android·源码·animator
delta_hell17 小时前
【阅读源码--Android】动画之ValueAnimator--1
android·源码·valueanimator
消失的旧时光-194318 小时前
第 2 篇:Android 控制屏为什么与机器人主控使用 TCP 长连接?
android·tcp/ip·机器人