Intent传值
第一个界面发送数据
Intent intent=new Intent(MainActivity.this,Address.class);
intent.putExtra("integer",5);
intent.putExtra("double",2.55);
intent.putExtra("string","test");
第二个界面接收数据
Intent intent=getIntent();
Integer driverid=intent.getIntExtra("driverid",0);
double finalMoney1= intent.getDoubleExtra("money",0);
String string=intent1.getStringExtra("string");
通过Bundle
第一个界面发送数据:
Intent intent=new Intent(MainActivity.this,Address.class);
Bundle bundle=new Bundle();
bundle.putCharSequence("name","test");
bundle.putInt("Int",2);
bundle.putDouble("double1",2.257);
bundle.putString("string","main");
intent.putExtras(bundle);
第二个界面接收数据
Intent intent1=getIntent();
Bundle bundle1=intent1.getExtras();
String name=bundle1.getString("name");
int Int=bundle1.getInt("Int");
double double1=bundle1.getDouble("double1",0);//第二值是默认值
String string=bundle1.getString("string");
来源:https://blog.csdn.net/qq_43586051/article/details/99883891