public void broadcastEvent ( final int code , final Bundle payload ) { if ( SPFConfig . DEBUG ) { Log . d ( TAG , "Broadcasting event " + code + " with payload " + payload ) ; } for ( final OnEventListener listener : mEventListeners ) { //TODO is it thread safe? mHandler . post ( new Runnable ( ) { @ Override public void run ( ) { listener . onEvent ( code , payload ) ; } } ) ; } }
Broadcasts an event to all registered listeners . Each listener will receive a reference to the given bundle .