发送数据:

Bundle bundle = new Bundle();

bundle.putString("sex" , "男人");
bundle.putDouble("height" , 40,38);
 
Intent intent = new Intent();
intent.putExtras(bundle);
intent.setClass(ThisOne.this , ThatOne.class);
startActivity(intent);
 
接收数据:
Bundle bundle = this.getIntent().getExtras();
String sex = bundle.getString("sex");
double height = bundle.getDouble("height");

====================================
 
在Message中使用Bundle传递数据
 
Message msg = myHandler.obtainMessage();
Bundle b = new Bundle();
b.putInt("age" , 20);
b.putString("name" , "Jon");
msg.setData(b);
msg.sendToTarget();
 
class MyHandler extends Handler{
   public void handleMessage(Message msg){
      Bundle b = msg.getData();
      int age = b.getInt("age");
      String name = b.getString("name");
  }
}

Android Bundle的使用的更多相关文章

  1. android bundle存放数据详解

    转载自:android bundle存放数据详解 正如大家所知道,Activity之间传递数据,是将数据存放在Intent或者Bundle中 例如: 将数据存放倒Intent中传递: 将数据放到Bun ...

  2. 解决React Native unable to load script from assets index.android.bundle on windows

    React Native运行的时候,经常碰到React Native unable to load script from assets index.android.bundle on windows ...

  3. React Native: unable to load scripts from assets 'index.android.bundle' on real device

    问题:重新建了一个项目后,运行react-native run-android报: unable to load scripts from assets 'index.android.bundle' ...

  4. Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly

    解决此问题 以下方法每次都需要执行命令2才能更新 1.创建assets目录 mkdir android/app/src/main/assets 2.执行命令 react-native bundle - ...

  5. 项目初始化以后出现:Unable to load script from assets 'index.android.bundle

    Mac中真机测试React Native project时出现Unable to load script from assets 'index.android.bundle' 2018年01月21日 ...

  6. react native中Unable to load script from assets 'index.android.bundle'解决方案

    刚刚朋友问我,说是创建好一个项目,运行后报错:Unable to load script from assets 'index.android.bundle',以前好好的没出现这种现象,于是我找到一个 ...

  7. Unable to load script from assets 'index.android.bundle' 出错?

    野路子太多,坑人真的!F**k 言归正传,当你运行 react native 程序的时候出现这个错误 ,如果您使用Windows,请按以下方式运行命令,或者如果出现错误“无法找到条目文件index.a ...

  8. React-Native 之 index.android.bundle

    问题: index.android.bundle  这个bug 我相信很少同学会遇到,然而就是这个问题,困扰了我跟我的同事多天, 各种方法处理:  进入 android 目录  ./gradlew c ...

  9. Android——Android Bundle详解(转)

    Android Bundle详解 1 Bundle介绍 Bundle主要用于传递数据:它保存的数据,是以key-value(键值对)的形式存在的. 我们经常使用Bundle在Activity之间传递数 ...

  10. Unable to load script from assets 'index.android.bundle'.Make sure your bundle is packaged correctly or you're running a packager server

    curl -k 'http://localhost:8081/index.android.bundle?platform=android' > android/app/src/main/asse ...

随机推荐

  1. 金融系列4《PUTKEY指令》

    用一个新的密钥替换一个已经存在的密钥:新密钥可以有与被替换的密钥相同的或不同的密钥版本号,但是必须与被替换的密钥有相同的密钥标识符. 用新密钥替换多个已经存在的密钥:新密钥可以有与被替换的密钥相同的或 ...

  2. awk简明教程

    我在这里的教程并不想面面俱到,全是示例,基本无废话. 我只想达到两个目的: 1)你可以在乘坐公交地铁上下班,或是在坐马桶拉大便时读完(保证是一泡大便的工夫). 2)我只想让这篇博文像一个火辣的脱衣舞女 ...

  3. md RAID

    md: mdadm: 将任何块设备做成RAID 模式化的命令:1.创建模式 -C 专用选项: -l: 级别 -n #: 设备个数 -a {yes|no}: 是否自动为其创建设备文件 -c: CHUNK ...

  4. Leetcode#78 Subsets

    原题地址 有两种方法: 1. 对于序列S,其子集可以对应为一个二进制数,每一位对应集合中的某个数字,0代表不选,1代表选,比如S={1,2,3},则子集合就是3bit的所有二进制数. 所以,照着二进制 ...

  5. matlab中函数fscanf

    matlab中函数fscanf matlab中函数fscanf在文件读取方面的实例如下: 从文件中有格式地读数据 fscanf 语法1:[a,count]=fscanf(fid,format,size ...

  6. [转]CentOS 5.5下FTP安装及配置

    一.FTP的安装 1.检测是否安装了FTP : [root@localhost ~]# rpm -q vsftpd vsftpd-2.0.5-16.el5_5.1 否则显示:[root@localho ...

  7. spoj 78

    数学  组合 隔板法 #include <iostream> #include <cstring> #include <cstdio> #include <s ...

  8. Tutorial Unity 4 apk splitting into OBB for google play

    http://docs.unity3d.com/Manual/android-OBBsupport.html http://www.exoa.fr/tutorial-unity-4-apk-split ...

  9. linux源码阅读笔记 jmpi指令(转)

    jmpi是段间跳转指令,用于x86实模式下, 如:BOOTSEG = 0x0c70 jmpi    4, #BOOTSEG 假如当前段CS==00h,那么执行此指令后将跳转到段CS==0x0c70,当 ...

  10. Mongo常用操作

    设置登陆验证 进入Mongo添加用户    db.addUser('root','123456') 编辑Mongo配置文件  vi /etc/mongod.conf   找到#auth = true ...