从Observable的onNext()方法返回值

时间:2018-12-06 10:48:35

标签: android observable rx-java

是否有办法从下一个观察值返回值?

这是我的示例代码:

 public void getAllWelcomeScreen() {
    Observable<WelcomeScreenResponse> call =
            restApi.getAllWelcomeScreen("application/json");
    call.subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<WelcomeScreenResponse>() {
        @Override
        public void onCompleted() {}
        @Override
        public void onError(Throwable e) {}
        @Override
        public void onNext(final WelcomeScreenResponse response) {
            welcomeScreenResponse = response;
        }
    });
}

0 个答案:

没有答案