Realm + Retrofit + Rxjava

Viewed 5809

I'm trying to figure out a way to save my Parsed objects from retro into realm through rxjava observable.

Right now I have an API call:

fetchCatalogData().subscribeOn(Schedulers.io())
                  .subscribe(data ->
                       saveToRealm();
                  )

This doesn't work because either I'm using realm on different treads or that scheduler.io doesn't have a looper. I'm not sure what's the best way to work with retrofit, realm and rxjava. I want to be able to save all my data when it arrives from retrofit and then access it afterwards.

3 Answers
Related