語言

BroadcastReceiver.SetResult(Result, String, Bundle) 方法

定義

更改所有從此廣播回傳的結果資料;只適用於透過 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

參數

code
Result

新的結果代碼。 通常會使用活動(Activity android.app.Activity#RESULT_CANCELED )和 android.app.Activity#RESULT_OK 常數,但這個數值的實際意義最終還是由廣播者決定。

data
String

新的結果數據。 這是一串任意的字串,其解釋由廣播商決定;可能是零。

extras
Bundle

新的額外資料地圖。 這是一個包含任意資料的 Bundle,其解讀由廣播者決定。 可以設定為 null。 這完全取代了目前的地圖(如果有的話)。

屬性

備註

更改所有從此廣播回傳的結果資料;只適用於透過 Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast的廣播。 所有目前的結果資料都被此方法所賦予的值所取代。

<強>此方法不適用於非順序廣播,如以 Context#sendBroadcast(Intent) Context.sendBroadcast</strong 傳送的>

Java 文件 android.content.BroadcastReceiver.setResult(int, java.lang.String, android.os.Bundle)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於