Android 两个Activity 之间传递参数

直接上代码

 Intent intent = new Intent();
 intent.setClass(MainActivity.this, Test1Activity.class);
 intent.putExtra("str", "come from first activity");
 startActivity(intent);

在另一个Activity中接受参数

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

  Intent intent = getIntent();
  Bundle bundle = intent.getExtras();
  String str = bundle.getString("str");

}

原文地址:https://www.cnblogs.com/oftenlin/p/2892736.html