我想将以下三个元素从一项活动传递给另一项活动:
String a = "a";
String b = "b";
String c = "c";
我尝试了以下但没有成功:
在主活动(MainActivity)中:
Bundle extras = new Bundle();
extras.putString("a", a);
extras.putString("b", b);
extras.putString("c", c);
Intent intent = new Intent(MainActivity.this, SubActivity.class);
intent.putExtras(extras);
startActivity(intent);
在子活动(SubActivity)中:
Bundle extras = new Bundle();
String a = extras.getString("a");
String b = extras.getString("b");
String c = extras.getString("c");