Hi guys I have a question, I googled something but I didn't find something interesting.
I have two threads in java, one in background another one in foreground (UI). When backgrounds' threads changes state of gui variable I would like to send an asynchronous event. Exists events, handlers, but all these staff need to be implemented.
Does exist any shorter way to pass an event like EventBus in Android?
Thank you!
You can try Google Guava EventBus.
The following is a simple example from Guava EventBus Examples by Ram Satish
package com.javarticles.guava;
import com.google.common.eventbus.EventBus;
public class SimpleEventBusExample {
public static void main(String[] args) {
EventBus eventBus = new EventBus();
eventBus.register(new SimpleListener());
System.out.println("Post Simple EventBus Example");
eventBus.post("Simple EventBus Example");
}
}