多个activity之间进行数据传输目前我知道的有两种一种是intent.putExtra("键",值);另一种是intent.putExtras(Bundle);
第一种是直接用intent来当点击某个按钮时跳转
Intent intent=new Intent(MainActivity.this,SecondActivity.class);
intent.putExtra("Schoolname","wfu");
startActivity(intent);
然后在第二个activity中读取数据
Intent intent=getIntent();
String schoolname=intent.getStringExtra("Schoolname");
第二种就是需要加个Bundle来绑定数据
Intent intent=new Intent(MainActivity.this,SecondActivity.class);
Bundle bundle=new Bundle();
bundle.putString("schoolname","wfu");
bundle.putString("classname","java");
bundle.putInt("age",20);
intent.putExtras(bundle);
startActivity(intent);
读取
Intent intent=getIntent();
Bundle bundle=intent.getExtras();
String schoolname=bundle.getString("schoolname");
String classname=bundle.getString("classname");
int age=bundle.getInt("age");