标签:protected first set str start log int err bre
1.在A这个Activity中以startActivityForResult(intent, requestCode)启动B这个Activity
2.在B这个Activity中
setResult(resultCode, intent);
finish();
结束活动
3.重写A这个Activity的onActivityResult(int requestCode, int resultCode, Intent data)方法来处理数据
如:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case 1:
if (resultCode == RESULT_OK) {
String returnedData = data.getStringExtra("data_return");
Log.d("FirstActivity", returnedData);
}
break;
default:
break;
}
}
标签:protected first set str start log int err bre
原文地址:http://www.cnblogs.com/itfenqing/p/6715046.html