greenrobot / EventBus

Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
http://greenrobot.org/eventbus/
Apache License 2.0
24.68k stars 4.66k forks source link

Receive Multiple Events in Single Activity #672

Closed patelakshay13890 closed 3 years ago

patelakshay13890 commented 3 years ago

How can I receive multiple events triggered from my lib module to Single Activity in Android Java ?

andob commented 3 years ago

Simply create a method on each event type:

@Subscribe
fun onSomethingHappened(event : OnSomethingHappenedEvent) {}

@Subscribe
fun onSomethingElseHappened(event : OnSomethingElseHappenedEvent) {}