Thread mode
EventBus
, by default, delivers the event in the subscriber in the same thread where the sender posted the event. Although this delivery scheme might work for most use cases, such as events that perform Android UI changes, when a long operation is executed in the event callback, the subscriber might block the main thread and prevent the system from running the UI rendering in time and drop some UI frames as a result.
To cope with time-consuming operations that might happen during the event delivery, the EventBus
library allows us to define the Thread in which the Bus
will call to deliver the event to the subscriber (ThreadMode
).
There are four modes supported by EventBus
that we can use to control the event delivering behavior:
ThreadMode.POSTING
– The subscribers callback will be invoked in the same thread where the sender posted the event. This is default behavior and the events will be delivery synchronously to all the entities that subscribed to the dispatched event.ThreadMode...