Does anyone have an example of using the EventBusBuilder
for greenrobot's Eventbus
?
I have an app that is using EventBus.getDefault()
all over the place, but now I want to configure that bus to stop sending the no subscriber message. It is discussed here: https://github.com/greenrobot/EventBus/blob/master/HOWTO.md
Since the code to configure an EventBus
, seems to return an instance of the bus itself (from the doc above):
EventBus eventBus = EventBus.builder().logNoSubscriberMessages(false).sendNoSubscriberEvent(false).build();
I am just not sure where to put that instance! Do I have to make a singleton somewhere to include it, just like the EventBus
library itself does? And then re-plumb all of my calls to EventBus.getDefault()
to my own class?
Just a little confused. Help is appreciated.
Thanks,
Judd
You don't read the document carefully. Here is what you want:
EventBus.builder().logNoSubscriberMessages(false).
sendNoSubscriberEvent(false).installDefaultEventBus();
Then EventBus.getDefault()
should work with this config