Android.OS.RemoteCallbackList.BeginBroadcast Method
Prepare to start making calls to the currently registered callbacks.

Syntax

[Android.Runtime.Register("beginBroadcast", "()I", "GetBeginBroadcastHandler")]
public virtual int BeginBroadcast ()

See Also

RemoteCallbackList.GetBroadcastItem(int)
RemoteCallbackList.FinishBroadcast

Returns

Documentation for this section has not yet been entered.

Remarks

Prepare to start making calls to the currently registered callbacks. This creates a copy of the callback list, which you can retrieve items from using RemoteCallbackList.GetBroadcastItem(int). Note that only one broadcast can be active at a time, so you must be sure to always call this from the same thread (usually by scheduling with Android.OS.Handler) or do your own synchronization. You must call RemoteCallbackList.FinishBroadcast when done.

A typical loop delivering a broadcast looks like this:

java Example

 int i = callbacks.beginBroadcast();
 while (i > 0) {
     i--;
     try {
         callbacks.getBroadcastItem(i).somethingHappened();
     } catch (RemoteException e) {
         // The RemoteCallbackList will take care of removing
         // the dead object for us.
     }
 }
 callbacks.finishBroadcast();

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1