It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




7年前关闭。




谁能告诉我们如何从我们从另一个 Activity 传递的 Intent 中获取 请求代码

最佳答案

如果你这样做

intent.putExtra("requestCode", requestCode);

您可以通过以下方式获取:
int requestCode = getIntent().getExtras().getInt("requestCode");

或者

如果你这样做 startActivityForResult 像这样:
startActivityForResult(intent, requestCode);

请求代码作为参数存在:
protected void onActivityResult(int requestCode, int resultCode, Intent data)

10-08 19:03