传递方:

//点击btn_sub传递 fieldHeight.getText()和 fieldWeight.getText()

private void setListeners()
    {
     btn_sub.setOnClickListener(calrBMI); 
    }
    private OnClickListener calrBMI = new OnClickListener()
    {
     public void onClick(View v)
     {

Intent intent = new Intent();
       Bundle bundle = new Bundle();
       bundle.putString("key_height", fieldHeight.getText().toString());
       bundle.putString("key_weight", fieldWeight.getText().toString());
       intent.setClass(ActivityMain.this,Report.class);
       intent.putExtras(bundle);
       startActivity(intent);         
     }    
    };

接收方:

Bundle bundle = new Bundle();
         bundle = this.getIntent().getExtras();
         double height = Double.parseDouble(bundle.getString("key_height"))/100;
         double weight = Double.parseDouble(bundle.getString("key_weight"));

 
 
 
 

Android 用Intent和Bundle传递参数的更多相关文章

  1. Android,使用Intent或Bundle传递参数,跳转页面。

    (1)使用Intent跳转页面: 第一个activity:MainActivity.java中: Intent myIntent = new Intent(); myIntent.putExtra(& ...

  2. 在Android中通过Intent使用Bundle传递对象

    IntentBundle传递对象SerializableParcelable Android开发中有时需要在应用中或进程间传递对象,下面详细介绍Intent使用Bundle传递对象的方法.被传递的对象 ...

  3. 17_Android中Broadcast详解(有序广播,无序广播)最终广播,Bundle传递参数,传递参数的时候指定权限

     1  Broadcast是Android中的四大组件之一,他的用途很大,比如系统的一些广播:电量低.开机.锁屏等一些操作都会发送一个广播. 2  广播被分为两种不同的类型:"普通广播( ...

  4. 【转】Android中如何使用Bundle传递对象[使用Serializable或者Parcelable] -- 不错

    原文网址:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2012/1211/694.html Android中Bundle类的作用 Bun ...

  5. Android 笔记 Intent and Bundle day7

    学习了Intent与Bundle的使用,进行应用中的交互 package com.example.intent; import android.app.Activity; import android ...

  6. html5页面与android页面之间通过url传递参数

    html5页面与android页面之间可以通过url传递参数,android将参数放在htm5的url  ?后面,js获取url  ?号后面的参数. 方法一: <scrīpt> /* 用途 ...

  7. Activity 间 bundle 传递参数

    activity_main.xml <TableLayout xmlns:android="http://schemas.android.com/apk/res/android&quo ...

  8. Android学习总结——Activity之间传递参数

    核心内容:一.在 Activity 之间传递简单数据二.在 Activity 之间传递复杂数据 三.在 Activity 之间传递自定义值对象   软件环境:Android Studio   一.在 ...

  9. 跳转页面,传递参数——android

    android 跳转页面并传递对象(实体类)——项目中是集港收货类 网上资料:两种传递方法Serializable,parcelable 优劣比较:Serializable数据更持久化,网络传输或数据 ...

随机推荐

  1. Sublime Text2上搭建C/C++环境

    环境:Sublime Text2            win7 64位 1.下载Sublime Text2并安装     下载地址:http://www.sublimetext.com/ 2.需要用 ...

  2. 合理配置MySQL缓存 提高缓存命中率

    众所周知,系统读取数据时,从内存中读取要比从硬盘上速度要快好几百倍.故现在绝大部分应用系统,都会最大程度的使用缓存(内存中的一个存储区域),来提高系统的运行效率.MySQL数据库也不例外.在这里,笔者 ...

  3. CPrintDialog 构造函数参数详解

    CPrintDialog 构造Windows打印或打印设置对话框(两者不同)     打印对话框                                                     ...

  4. Visual Stuido 2015 Community 使用 GitHub 插件

    微软在Visual Studio 2015产品中,深度整合了GitHub,让VS用户更方便的使用GitHub的服务. 新闻链接: Announcing the GitHub Extension for ...

  5. Linux启动提示“unexpected inconsistency;RUN fsck MANUALLY”

    问题:在开机启动时,提示“unexpected inconsistency;RUN fsck MANUALLY”进不了系统 解决方法: fsck不仅可以对文件系统进行扫描,还能修正文件系统的一些问题, ...

  6. POJ 1661 Help Jimmy -- 动态规划

    题目地址:http://poj.org/problem?id=1661 Description "Help Jimmy" 是在下图所示的场景上完成的游戏. 场景中包括多个长度和高度 ...

  7. 客户端获取服务器SessionID (Asp.net SessionID)

    SessionID是客户端首次访问某个方法或页面, 并且这个方法中设置了Session["xxx"]=xx; 此时服务器返回的响应头(HttpResponse.Headers)中会 ...

  8. Linux时间设置

    Linux时间分为系统时间和硬件时间. 查看系统时间:date 将系统时间写入硬件:hwclock --systohc 查看硬件时间:hwclock --show 将硬件时间写入系统:hwclock ...

  9. SQL技术内幕三

    Select 分析一个查询实例 Select empid,year(orderdate) as orderYear,count(*) as orderCount From dbo.orderInfo ...

  10. oracle11g 表或视图连接时有可能发生的问题

    ---------背景--------- oracle11g 有2个视图,都有一个id字段,且id字段的值相同 例如:id都有 A01 ,A02 ,A03 --------问题--------- 把2 ...