You can do something like this (from rx.subjects.PublishSubject):
PublishSubject<Object> subject = PublishSubject.create(); // observer1 will receive all onNext and onCompleted events subject.subscribe(observer1); subject.onNext("one"); subject.onNext("two"); // observer2 will only receive "three" and onCompleted subject.subscribe(observer2); subject.onNext("three"); subject.onCompleted();
If you can introduce the Subject interface into a service and PublishSubject into an Activity (or vice versa depending on what you are doing), you can have a good separation of problems.
Bobby hargett
source share