当前位置: 代码迷 >> Android >> android activity 其间传递参数
  详细解决方案

android activity 其间传递参数

热度:97   发布时间:2016-05-01 20:30:18.0
android activity 之间传递参数

?发送方:

  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"));

  相关解决方案