当前位置: 首页 > news >正文

Android中使用intent可以传递哪些类型的数据?

Intent可以传递的数据类型基本上分为四种;

(1)基本数据类型(包括int,char,string等类型的数据);
//传递String
intent.putExtra("key_str","传递简单基础的数据");//获取
str = intent.getStringExtra("key_str");
(2)Bundle类型
//传递Bundle类型的数据
Bundle bundle = new Bundle();
bundle.putInt("key_bundle_int",1);
bundle .putString("key_bundle_str",str);Intent intent = new Intent(MainActivity.this,SecondActivity.class);
intent.putExtras(bundle)//获取Bundle
Intent intent = getIntent();
Bundle bundle = intent.getExtras();//获取Bundle里的值
bundle.getInt("key_bundle_int")
bundle.getString("key_bundle_str")
(3)Serializable对象(通过serializable接口传递序列化数据);
//前提:自定义对象实现Serializa

相关文章:

  • Python利用pygame实现飞机大战游戏
  • node.js快速入门-day03
  • 使用ansible批量修改操作系统管理员账号密码
  • 内网横向1
  • Pytorch:torch.cuda.empty_cache()
  • uniapp 开发微信小程序 出现启用组件按需注入问题如何解决
  • 基于Springboot的防疫物资管理信息系统(有报告)。Javaee项目,springboot项目。
  • 【论文阅读】Masked Autoencoders Are Scalable Vision Learners
  • Docker常用命令!!!
  • 九.pandas绘图基础
  • Python基础----数据容器(持续更新中)
  • QGIS编译(跨平台编译)056:PDAL编译(Windows、Linux、MacOS环境下编译)
  • Learn OpenGL 19 几何着色器
  • java 通过 IMetaStoreClient 取 hive 元数据信息
  • 基于ArcGIS等多技术融合提升环境、生态、水文、土地、农业、大气等领域科研技术应用
  • 【跃迁之路】【735天】程序员高效学习方法论探索系列(实验阶段492-2019.2.25)...
  • CentOS学习笔记 - 12. Nginx搭建Centos7.5远程repo
  • EOS是什么
  • idea + plantuml 画流程图
  • Javascript弹出层-初探
  • leetcode378. Kth Smallest Element in a Sorted Matrix
  • Objective-C 中关联引用的概念
  • OpenStack安装流程(juno版)- 添加网络服务(neutron)- controller节点
  • Python学习之路16-使用API
  • Quartz实现数据同步 | 从0开始构建SpringCloud微服务(3)
  • Redux系列x:源码分析
  • vue.js框架原理浅析
  • vue2.0项目引入element-ui
  • WebSocket使用
  • 测试开发系类之接口自动化测试
  • 构造函数(constructor)与原型链(prototype)关系
  • 基于游标的分页接口实现
  • 聊聊hikari连接池的leakDetectionThreshold
  • 每个JavaScript开发人员应阅读的书【1】 - JavaScript: The Good Parts
  • 十年未变!安全,谁之责?(下)
  • 手机端车牌号码键盘的vue组件
  • 线性表及其算法(java实现)
  • 一文看透浏览器架构
  • #### go map 底层结构 ####
  • #AngularJS#$sce.trustAsResourceUrl
  • $(function(){})与(function($){....})(jQuery)的区别
  • (03)光刻——半导体电路的绘制
  • (待修改)PyG安装步骤
  • (附源码)计算机毕业设计SSM在线影视购票系统
  • (续)使用Django搭建一个完整的项目(Centos7+Nginx)
  • (转)清华学霸演讲稿:永远不要说你已经尽力了
  • (转)为C# Windows服务添加安装程序
  • .net wcf memory gates checking failed
  • .net 验证控件和javaScript的冲突问题
  • .net中我喜欢的两种验证码
  • /*在DataTable中更新、删除数据*/
  • @Data注解的作用
  • @EventListener注解使用说明
  • @RequestMapping用法详解
  • @SuppressWarnings注解