In the following code, how and where to put unSubscribe
to make un-subscription of the Observable
explicitly exactly after finishing the onComplete
?.
getObservable()
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Subscriber<Boolean>() {
@Override
public void onCompleted() {
doSomething();
}
@Override
public void onError(Throwable e) {
thereIsError();
}
@Override
public void onNext(Boolean status) {
updateView();
}
});
onError
gets called? WIll that lead to memory leaks because the stream is not disposed? – Cronk