//intent:Activity1跳转到Activity2,并传参数
Intent intent = new Intent();
intent.setClass(mContext, Activity2.class);
intent.putExtra("item_1", data.get(arg2).get("name")+"");
String sarr[]= {"2_选项1","2_选项2","2_选项3","2_选项4"};
intent.putExtra("sarr", sarr);
startActivity(intent);
//Activity2获取由Activity1传送过来的参数
Intent intent = getIntent();
String item_1 = intent.getStringExtra("item_1") + "";
String[] sarr = intent.getStringArrayExtra("sarr");
//AndroidManifest.xml中添加Activity2
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity2"></activity>
转载于:https://blog.51cto.com/hustxq/1727871