Posting sticking events
Whenever we publish an event on the bus, the EventBus broker automatically delivers the event to all the current subscribers, and by default, will immediately clear the transient event. The new subscribers that register after the event is delivered to the current subscribers will not get the event.
There are situations when a new subscriber registers on the bus and no new event is produced or submitted on the Bus for a long period of time. As such, the subscriber will wait until the next event appears on the bus to produce any output from it.
Furthermore, when the new subscriber is responsible for updating an Android UI component like an Activity
or a Fragment
, the subscribers have to wait for a new event to occur, hence, it might delay the UI update for a significant amount of time.
To solve this problem, the EventBus
allows us to create Sticky
events that are kept in the memory and delivered to subscribers once they register on the Bus. EventBus
will keep the latest...