Hot questions for Using EventBus in android activity

Top 10 Java Open Source / EventBus / android activity


When we use an event bus (from Guava) to fetch async responses from server - everything works absolutely correctly. But if we want to to open another instance of the same activity on top, then our Subscribe-events will be processed also in the bottom (stopped) activity what causes different sources of bugs.

Is it possible to make event bus's events to be processed only by a single subscriber from the current top activity?


You can remove all the sticky event when you activity re-creates on just before destroy using:-

stickyEvent= EventBus.getDefault().getStickyEvent(classType);
// Better check that an event was actually posted before
        if(stickyEvent != null) {
            // "Consume" the sticky event