How to save Bitmap to a file asynchronously?

I want to save Bitmap to a file. Do it using FileOutputStream. On StackOverflow write that such operations should be done asynchronously. I want to know is it possible to achieve this using RxJava? If Yes then I can show how )) !
April 4th 20 at 13:20
1 answer
April 4th 20 at 13:22
Solution
Yes, it is better to do in the background. Something like this:
D Disposable = Observable.fromCallable(() -> {
 // save bitmap
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe();

And don't forget to call d.dispose() method in onDestroy() of your activity or fragment.
PS code is not tested, I am writing from memory from the phone.

Find more questions by tags AndroidReactive Extensions