需要跳转的activity调用startActivityForResult(Intent intent);
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ORDERPAY_REMARK_REQUEST && data != null) { String remark = data.getStringExtra("remark"); tvOrderpayRemark.setText(remark); this.remark = remark; } }
返回的activity的界面
如果没有数据需要传回原来的activity就不用new Intent了
Intent tencentPoiIntent = new Intent(); Bundle bundle = new Bundle(); bundle.putString("addressName", resultData.title); bundle.putDouble("lat", resultData.location.lat); bundle.putDouble("lng", resultData.location.lng); tencentPoiIntent.putExtras(bundle); setResult(CodeManager.ADDRESS_SEARCH_REQUEST, tencentPoiIntent);