Rafał Piekara Rafał Piekara - 1 month ago 21
Android Question

Observable<Drawable> to simple Drawable

I have Android application with method which return image as Observable. I need this image to use it in button.setDrawable(Drawable). So I need simple Drawable type. How to get image like this from this return statement?

Answer

So I need simple Drawable type. How to get image like this from this return statement?

you have to subscribe the Observable. The Subscribe#onNext will receive the Drawable as parameter. Be aware that you have to call setButton from the Ui thread. So remember to be observing (observeOn) to the right thread (the UI thread)

Comments