Share via


Activity.SetResult Method

Definition

Overloads

SetResult(Result)

Call this to set the result that your activity will return to its caller.

SetResult(Result, Intent)

Call this to set the result that your activity will return to its caller.

SetResult(Result)

Call this to set the result that your activity will return to its caller.

[Android.Runtime.Register("setResult", "(I)V", "")]
public void SetResult (Android.App.Result resultCode);
[<Android.Runtime.Register("setResult", "(I)V", "")>]
member this.SetResult : Android.App.Result -> unit

Parameters

resultCode
Result

The result code to propagate back to the originating activity, often RESULT_CANCELED or RESULT_OK

Attributes

Remarks

Call this to set the result that your activity will return to its caller.

Java documentation for android.app.Activity.setResult(int).

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.

See also

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

Applies to

SetResult(Result, Intent)

Call this to set the result that your activity will return to its caller.

[Android.Runtime.Register("setResult", "(ILandroid/content/Intent;)V", "")]
public void SetResult (Android.App.Result resultCode, Android.Content.Intent? data);
[<Android.Runtime.Register("setResult", "(ILandroid/content/Intent;)V", "")>]
member this.SetResult : Android.App.Result * Android.Content.Intent -> unit

Parameters

resultCode
Result

The result code to propagate back to the originating activity, often RESULT_CANCELED or RESULT_OK

data
Intent

The data to propagate back to the originating activity.

Attributes

Remarks

Call this to set the result that your activity will return to its caller.

As of android.os.Build.VERSION_CODES#GINGERBREAD, the Intent you supply here can have Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION and/or Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION set. This will grant the Activity receiving the result access to the specific URIs in the Intent. Access will remain until the Activity has finished (it will remain across the hosting process being killed and other temporary destruction) and will be added to any existing set of URI permissions it already holds.

Java documentation for android.app.Activity.setResult(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.

See also

Applies to