Putra Yogi
Putra Yogi

Reputation: 45

Cannot resolve method io()

I am still new with this RxAndroid And Rxjava and I got this error on .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 {

                    }
                })
        );
    }

Upvotes: 0

Views: 225

Answers (1)

Bach Vu
Bach Vu

Reputation: 2348

It should be Schedulers.io with an s. So your code should be like this:

compositeDisposable.add(iPokemonDex.getListPokemon()
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<Pokedex>() {
                    @Override
                    public void accept(Pokedex pokedex) throws Exception {

                    }
                })
        );

Upvotes: 1

Related Questions