I'm new to RXJava. I have this code
Observable.just(
getAllImagesFromFirebaseStorage(
spotsList.get(i).getName(),
spotsList.get(i).getZones().get(j).getZoneImage(),
outputStream
)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(item -> {
Log.i("test", "inside subscribe rxjava");
linearProgressIndicator.setProgressCompat(item, true);
}).dispose();
I'm calling the method getAllImagesFromFirebaseStorage
that downloads images from firebase and stores them in internal memory, but it freezes the UI so I'm trying to implement RXJava so that the method can be performed in a secondary thread.
getAllImagesFromFirebaseStorage
returns an Integer which should be updating the linearProgressIndicator
I've been watching tutorials on implementing RXJava but it doesn't seem to work for me because it enters in the .subscribe
part of the code immediately and item
is always zero.
I understand that on .subscribe
I'm getting the response of the method I'm calling on the secondary thread, is that so?
What can I be doing wrong?