我有一个BehaviourSubject
使用Observable
链接了另一个flatMap
。如果订阅是通过singleSubscrier
完成的,则onNext()
方法永远不会被调用。替换为Observer
或Subscriber
后,即可开始接听onNext()
来电。
private Observable<chatObject> getObservable() {
return loadBehaviorSubject()
.flatMap(new Func1<chatObject, Observable<chatObject>>() {
@Override
public Observable<chatObject> call(final chatObject object) {
return chaninedObservable.map(
new Func1<chatObject, ChatObject>() {
@Override
public ChatObject call(chatObject object) {
// do some operations here
}
});
}
});
}