Android开发之页面跳转传递list集合
2024-10-18 22:57:13
这篇随笔这里详细记录两个activity之间如何传递list集合中的数据。
1、首先要对javabean进行序列化处理,即实现Serializable。
package com.anhua.bean; import java.io.Serializable; public class YunDanBean implements Serializable{
private String yunhao;// 承运号
private String huohao;// 货号
private String hwpm;// 品名 public String getYunhao() {
return yunhao;
} public void setYunhao(String yunhao) {
this.yunhao = yunhao;
} public String getHuohao() {
return huohao;
} public void setHuohao(String huohao) {
this.huohao = huohao;
} public String getHwpm() {
return hwpm;
} public void setHwpm(String hwpm) {
this.hwpm = hwpm;
}
}
2、页面跳转,发送list数据
List<YunDanBean> listdetail = new ArrayList<YunDanBean>();
Intent intent = new Intent(WayBillActivity.this, WayBillMessage.class);
intent.putExtra("listdetail", (Serializable) listdetail);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
3、另一个页面接受数据
yundanList = (List<YunDanBean>) getIntent().getSerializableExtra("listdetail");
通过上面几个步骤即可完成两个activity之间传递list集合了。
最新文章
- Android中用TextView显示大量文字的方法
- Python数据分析
- c#语言-高阶函数
- 判断.net中在windows系统下的字节序
- TypeScript Generics(泛型)
- UIScrollView和控制器
- Android沉浸式任务栏的实现
- 【Git】笔记2
- 向量时钟Vector Clock in Riak
- Jmeter外部函数引用
- Java文件操作①——XML文件的读取
- PDB符号文件信息
- hive 0.11的安装配置
- linux 常用命令 -- 系统管理工具包: 监视邮件的使用情况
- 通知(Notification)的使用
- Android导航菜单横向左右滑动并和下方的控件实现联动
- 道可叨 | Python 标准库 urllib2 的使用细节
- Mysql基本命令一
- BZOJ_4590_[Shoi2015]自动刷题机_二分答案
- nginx学习路线
热门文章
- zabbix之 zabbix server 跟 agent 更换ip地址
- 第三章 C#程序结构[3.2 选择结构的应用(Windows窗体应用程序)(四)]
- 什么是FPGA的HP,HR I/O
- Mysql 数据库操作之DDL、DML、DQL语句操作
- debian下arp欺骗
- zabbix监控windows服务器
- linux关于 文件/文件夹的操作 中
- react学习笔记(二)
- Vue-cli3.0开发笔记
- 数据预处理:独热编码(One-Hot Encoding)和 LabelEncoder标签编码