RxJava2CallAdapterFactory.create()的作用是什么...

Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.example.com")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();

最佳答案

根据描述:

使用RxJava 2创建可观察对象的调用适配器。将此类添加到Retrofit允许您从服务方法返回Observable,Flowable,Single,Completable或Maybe。

interface MyService {
    @GET("user/me")
    Observable<User> getUser()
}

没有它,您无法将接口(interface)描述为rx类型

关于android - RxJava2CallAdapterFactory.create()在改造中的作用是什么,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45853822/

10-11 22:26
查看更多