Is using event library like Otto or EventBus a recommended way to handle relations between Activities, Fragments, and background threads [closed]

The event bus and Otto are not “recommended ways” by the Android developer guide primarily because they are third party libraries to simplify the task. And I believe Otto is fairly new, so older guides obviously aren’t using it. I personally like Otto, it’s what I use and I haven’t had any problems with it … Read more

How to send event from Service to Activity with Otto event bus?

To post from any thread (main or background) and receive on the main thread, try something like public class MainThreadBus extends Bus { private final Handler mHandler = new Handler(Looper.getMainLooper()); @Override public void post(final Object event) { if (Looper.myLooper() == Looper.getMainLooper()) { super.post(event); } else { mHandler.post(new Runnable() { @Override public void run() { MainThreadBus.super.post(event); … Read more