setdata
Intent intent = new Intent();
intent.setClass(Bmi.this, Report.class);
Bundle bundle = new Bundle();
bundle.putString("KEY_HEIGHT", field_height.getText().toString());
bundle.putString("KEY_WEIGHT", field_weight.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
getdata
Bundle bunde = this.getIntent().getExtras();
double height = Double.parseDouble(bunde.getString("KEY_HEIGHT"))/100;
double weight = Double.parseDouble(bunde.getString("KEY_WEIGHT"));
Intent intent = new Intent();
intent.setClass(Bmi.this, Report.class);
Bundle bundle = new Bundle();
bundle.putString("KEY_HEIGHT", field_height.getText().toString());
bundle.putString("KEY_WEIGHT", field_weight.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
getdata
Bundle bunde = this.getIntent().getExtras();
double height = Double.parseDouble(bunde.getString("KEY_HEIGHT"))/100;
double weight = Double.parseDouble(bunde.getString("KEY_WEIGHT"));
本文介绍了一个简单的BMI身体质量指数计算器的应用程序。该程序通过Intent传递身高和体重数据到另一个Activity,并从那里接收计算后的BMI值返回。涉及到的技术包括Android应用程序组件间的通信、数据捆绑使用等。
862

被折叠的 条评论
为什么被折叠?



