我有3个活动:
这是所需的工作流程:
但是,当应用程序到达我称为finish()的'B'的onActivityResult()方法时,我不会被引导回'A'。即使正在调用finish()方法,该应用仍保留在活动B上。
LoadingInfoActivity startActivityForResult()
Intent scanLoad = new Intent(LoadingInfoActivity.this,
LoadingScanActivity.class);
startActivityForResult(scanLoad, SCAN_LOCATION);
LoadingScanActivity startActivityForResult()
Intent reason = new Intent(LoadingScanActivity.this,
ReasonForSkip.class);
startActivityForResult(reason, GET_SKIP_REASON);
ReasonForSkip代码可返回上一个活动
Intent data = new Intent();
data.putExtra(REASON, reason);
setResult(RESULT_OK, data);
finish();
LoadingScanActivity onActivityResult方法(此代码可以运行,但不会将我重定向到LoadingInfo onActivityResult方法
if (requestCode == GET_SKIP_REASON){
String reason = data.getStringExtra("Reason");
Intent loadingInfo = new Intent();
data.putExtra("CageSkip", "Y");
data.putExtra("Reason", reason);
setResult(RESULT_OK, loadingInfo);
finish();
}
LoadingInfoActivity onActivityResult方法(我们从未达到这一点)
if (requestCode == SCAN_LOCATION){
if (resultCode == Activity.RESULT_OK) {
String reason = data.getStringExtra("Reason");
String skipped = data.getStringExtra("CageSkip");
// Process results
}
}
如果有一些文档或我想念的东西,我很高兴能为正确的方向指明为什么它不起作用。