Building an Android application that has various dynamic segments speaking with one another can get repetitive. To save time, developers often end up with tightly coupled components in their apps like Interfaces or directly calling an object’s function.
EventBus is a popular open-source library that was created to solve this problem using the publisher/subscriber pattern.
Using the EventBus library, you can pass messages from one class to one or more classes in just a few lines of code.
Methods of EventBus :
- register : To register your component to subscribe to events on the bus.
- unregister : To stop receiving events of the bus.
- post : To publish your event on the bus.