Share via


RemoteCallbackList.GetBroadcastItem(Int32) Method

Definition

Retrieve an item in the active broadcast that was previously started with #beginBroadcast.

[Android.Runtime.Register("getBroadcastItem", "(I)Landroid/os/IInterface;", "GetGetBroadcastItem_IHandler")]
public virtual Java.Lang.Object? GetBroadcastItem (int index);
[<Android.Runtime.Register("getBroadcastItem", "(I)Landroid/os/IInterface;", "GetGetBroadcastItem_IHandler")>]
abstract member GetBroadcastItem : int -> Java.Lang.Object
override this.GetBroadcastItem : int -> Java.Lang.Object

Parameters

index
Int32

Which of the registered callbacks you would like to retrieve. Ranges from 0 to 1-#beginBroadcast.

Returns

Returns the callback interface that you can call. This will always be non-null.

Attributes

Remarks

Retrieve an item in the active broadcast that was previously started with #beginBroadcast. This can <em>only</em> be called after the broadcast is started, and its data is no longer valid after calling #finishBroadcast.

Note that it is possible for the process of one of the returned callbacks to go away before you call it, so you will need to catch RemoteException when calling on to the returned object. The callback list itself, however, will take care of unregistering these objects once it detects that it is no longer valid, so you can handle such an exception by simply ignoring it.

Java documentation for android.os.RemoteCallbackList.getBroadcastItem(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.

Applies to

See also