无法解析方法 io()
Cannot resolve method io()
我对这个 RxAndroid 和 Rxjava 还是新手,我在 .subscribeOn(Scheduler.io())
上遇到了这个错误
private void fetchData() {
compositeDisposable.add(iPokemonDex.getListPokemon()
.subscribeOn(Scheduler.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Pokedex>() {
@Override
public void accept(Pokedex pokedex) throws Exception {
}
})
);
}
应该是 Schedulers.io
加上 s
。所以你的代码应该是这样的:
compositeDisposable.add(iPokemonDex.getListPokemon()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Pokedex>() {
@Override
public void accept(Pokedex pokedex) throws Exception {
}
})
);
我对这个 RxAndroid 和 Rxjava 还是新手,我在 .subscribeOn(Scheduler.io())
private void fetchData() {
compositeDisposable.add(iPokemonDex.getListPokemon()
.subscribeOn(Scheduler.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Pokedex>() {
@Override
public void accept(Pokedex pokedex) throws Exception {
}
})
);
}
应该是 Schedulers.io
加上 s
。所以你的代码应该是这样的:
compositeDisposable.add(iPokemonDex.getListPokemon()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Pokedex>() {
@Override
public void accept(Pokedex pokedex) throws Exception {
}
})
);