A.class
onCreate:
{
Intent intent = new Intent("test1");//會跳到B.class
Bundle bundle = new Bundle();
bundle.putString("toB", "toB");
intent.putExtras(bundle);
startActivityForResult(intent, 1);
}
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1:
if (resultCode == RESULT_OK) {
String returnValue = data.getExtras().getString("toA");
Log.e("onActivitiyResult", returnValue);
}
break;
default:
}
}