B4A Library EventBus Departing Gate 3

in my previous release, i chose to limit the "event" to a string: put a string on the bus, and anyone
registered for the bus received a string. since the event can be any object, i was trying to figure out
how to enable b4a users to define and enable an event of their own chosing. no need; just post
whatever object you want: string, int, list, map, bitmap. i tried them all. the eventbus sees an object.
the subscriber knows what the object on the bus is, so she just unwinds it when the event is triggered.

in other words, you post an object, and subscribers receive an object. publisher and subscriber
simply agree on the object type. i think that's the way the system is desiged, but i also think that
if the subscriber didn't know what the object was, it wouldn't be difficult to provide that
information. (eg, if the subscriber were looking for a string when an event containing a map was
triggered, it could be ignored. presumably, some subscriber somewhere was looking for an event
with a map. i didn't test this, but an object's type can be derived.)

the second release of the gbus library is attached, along with a example that sends a bitmap to
another activity. pity we never need anything like that...
 

Attachments

  • bus2.zip
    198.9 KB · Views: 101

DonManfred

Expert
Licensed User
Longtime User
Can you please add a downloadlink for the needed jar and aar?
 

drgottjr

Expert
Licensed User
Longtime User
sorry. they were in the original zip archive. here they are again.
 

Attachments

  • eventbus.zip
    42.2 KB · Views: 80
Top