I'm trying to create a DatabaseHelper class to separate out some Room things. DatabaseHelper is not an Activity or Fragment. I'm trying to do something like the following
roomDb.mediaItemDownloadDao()
.findById(mediaItemId)
.subscribeOn(Schedulers.io())
.subscribe(oldDownload -> {
oldDownload.setSomeField(true);
roomDb.mediaItemDownloadDao().insert(oldDownload);
});
}
but it tells me the result of subscribe is not used. is there a way to make sure that is executed and then dispose immediately ? should i be passing the disposable up to the caller? whats the best way to accomplish what i want / use rx objects outside of a fragment / activity ?