Skip to content Skip to sidebar Skip to footer

Download Image Via Glide With Rxjava

I need to download pictures (Bitmaps) via a given url. As I use Glide in my project to display the pictures I thought I could simply use their mechanism to download the pictures as

Solution 1:

I fixed it like below. Unfortunately I do not get the bitmap back but that is ok-ish for me for the moment.

public Completable get(final String url) {
    return Completable.create(new CompletableOnSubscribe() {
        @Override
        public void subscribe(CompletableEmitter emitter) throws Exception {
            Glide
                    .with(context)
                    .load(url)
                    .downloadOnly(2000, 2000);
            emitter.onComplete();
        }
    });
}

Post a Comment for "Download Image Via Glide With Rxjava"