A Single-Thread EventBus
add the jar to your project. Click to download the jar
- Prepare subscribers,Declare and annotate your subscribing method
@Subscribe
public void sayHello(String message) {
System.out.println(message);
}
- Register your subscriber
In Java
Cerberus.Companion.getDefault().register(this);
In Kotlin
Cerberus.getDefault().register(this)
- Post Event
In Java
Cerberus.Companion.getDefault().post("HelloWorld");
In Kotlin
Cerberus.getDefault().post("HelloWorld")
The event in Cerberus dont't support the int
、float
... in java,but support Integer
、String
、Float
...
And it don't support the Int
、Float
in Kotlin.