Condividi tramite


Activity.OnActivityResult(Int32, Result, Intent) Method

Definition

Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it.

[Android.Runtime.Register("onActivityResult", "(IILandroid/content/Intent;)V", "GetOnActivityResult_IILandroid_content_Intent_Handler")]
protected virtual void OnActivityResult (int requestCode, Android.App.Result resultCode, Android.Content.Intent? data);
[<Android.Runtime.Register("onActivityResult", "(IILandroid/content/Intent;)V", "GetOnActivityResult_IILandroid_content_Intent_Handler")>]
abstract member OnActivityResult : int * Android.App.Result * Android.Content.Intent -> unit
override this.OnActivityResult : int * Android.App.Result * Android.Content.Intent -> unit

Parameters

requestCode
Int32

The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.

resultCode
Result

The integer result code returned by the child activity through its setResult().

data
Intent

An Intent, which can return result data to the caller (various data can be attached to Intent "extras").

Attributes

Remarks

Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. The <var>resultCode</var> will be #RESULT_CANCELED if the activity explicitly returned that, didn't return any result, or crashed during its operation.

An activity can never receive a result in the resumed state. You can count on #onResume being called after this method, though not necessarily immediately after. If the activity was resumed, it will be paused and the result will be delivered, followed by #onResume. If the activity wasn't in the resumed state, then the result will be delivered, with #onResume called sometime later when the activity becomes active again.

This method is never invoked if your activity sets android.R.styleable#AndroidManifestActivity_noHistory noHistory to true.

Java documentation for android.app.Activity.onActivityResult(int, int, android.content.Intent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also

  • <xref:Android.App.Activity.StartActivityForResult(Android.Content.Intent%2c+System.Int32)>
  • <xref:Android.App.Activity.CreatePendingResult(System.Int32%2c+Android.Content.Intent%2c+Android.Content.Intent)>
  • SetResult(Result)