Partager via


BroadcastReceiver.SetResult(Result, String, Bundle) Method

Definition

Change all of the result data returned from this broadcasts; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

[Android.Runtime.Register("setResult", "(ILjava/lang/String;Landroid/os/Bundle;)V", "")]
public void SetResult (Android.App.Result code, string? data, Android.OS.Bundle? extras);
[<Android.Runtime.Register("setResult", "(ILjava/lang/String;Landroid/os/Bundle;)V", "")>]
member this.SetResult : Android.App.Result * string * Android.OS.Bundle -> unit

Parameters

code
Result

The new result code. Often uses the Activity android.app.Activity#RESULT_CANCELED and android.app.Activity#RESULT_OK constants, though the actual meaning of this value is ultimately up to the broadcaster.

data
String

The new result data. This is an arbitrary string whose interpretation is up to the broadcaster; may be null.

extras
Bundle

The new extra data map. This is a Bundle holding arbitrary data, whose interpretation is up to the broadcaster. Can be set to null. This completely replaces the current map (if any).

Attributes

Remarks

Change all of the result data returned from this broadcasts; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast. All current result data is replaced by the value given to this method.

<strong>This method does not work with non-ordered broadcasts such as those sent with Context#sendBroadcast(Intent) Context.sendBroadcast</strong>

Java documentation for android.content.BroadcastReceiver.setResult(int, java.lang.String, android.os.Bundle).

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