rxjava改型显示多个查询的结果

to94eoyn  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(200)

我有一个方法,允许我从服务器接收事件

getCamera.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .flatMap(Observable::fromIterable)
                .flatMap(Observable::fromIterable)
                .flatMap(events -> getApiMethods.getEvents(events.getAccessPoint().replace("hosts","")))
                .flatMap(Observable::fromIterable)
                .subscribe(new Observer<Event>() {
                    @Override
                    public void onSubscribe(@NonNull Disposable d) {

                    }

                    @Override
                    public void onNext(@NonNull Event event) {
                       Log.d ("RXJAVA", event.getType() + " " + event.getId() + " " + event.getTimestamp());
                    }

                    @Override
                    public void onError(@NonNull Throwable e) {
                    Log.d ("RXJAVA", String.valueOf(e));
                    }

                    @Override
                    public void onComplete() {

                    }
                });

但是我想改变它,这样flatmap的中间查询结果就可以使用了。我怎么能做到这一点呢?谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题