这篇随笔这里详细记录两个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集合了。

最新文章

  1. Android中用TextView显示大量文字的方法
  2. Python数据分析
  3. c#语言-高阶函数
  4. 判断.net中在windows系统下的字节序
  5. TypeScript Generics(泛型)
  6. UIScrollView和控制器
  7. Android沉浸式任务栏的实现
  8. 【Git】笔记2
  9. 向量时钟Vector Clock in Riak
  10. Jmeter外部函数引用
  11. Java文件操作①——XML文件的读取
  12. PDB符号文件信息
  13. hive 0.11的安装配置
  14. linux 常用命令 -- 系统管理工具包: 监视邮件的使用情况
  15. 通知(Notification)的使用
  16. Android导航菜单横向左右滑动并和下方的控件实现联动
  17. 道可叨 | Python 标准库 urllib2 的使用细节
  18. Mysql基本命令一
  19. BZOJ_4590_[Shoi2015]自动刷题机_二分答案
  20. nginx学习路线

热门文章

  1. zabbix之 zabbix server 跟 agent 更换ip地址
  2. 第三章 C#程序结构[3.2 选择结构的应用(Windows窗体应用程序)(四)]
  3. 什么是FPGA的HP,HR I/O
  4. Mysql 数据库操作之DDL、DML、DQL语句操作
  5. debian下arp欺骗
  6. zabbix监控windows服务器
  7. linux关于 文件/文件夹的操作 中
  8. react学习笔记(二)
  9. Vue-cli3.0开发笔记
  10. 数据预处理:独热编码(One-Hot Encoding)和 LabelEncoder标签编码