Android: Glide not showing large image from URL

I have found a solution that worked for my requirement. The override() method does the trick. Setting higher numbers for the target resolution seems to be the final workaround, but the bigger the numbers, the longer the time it would take to display the image(s), so it would be wise to implement a preloader/progressbar.

Glide.with(getContext())
    .asBitMap() //[for new glide versions]
    .load(url)
    //.asBitmap()[for older glide versions]
    //.placeholder(R.drawable.default_placeholder)
    .override(1600, 1600) // Can be 2000, 2000
    .into(new BitmapImageViewTarget(imageViewPreview) {
        @Override
        public void onResourceReady(Bitmap  drawable, GlideAnimation anim) {
            super.onResourceReady(drawable, anim);
            progressBar.setVisibility(View.GONE);
        }
    });

Custom centered preloader/progressbar placeholder indicator on relativeLayout xml:

<ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true" />

This is neat because another issue related about loading image asBitmap() in Glide will not show placeholders for error and preloader/progress indicator:

Glide.with(getActivity())
    .load(url).asBitmap()
    .placeholder() //<== will simply not work:
    .error() // <== is also useless
    .into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
        imageView.setImageBitmap(resource);
    }
});

In my research, I have also tried a Picasso solution to handle high quality image:

Picasso.with(getContext())
                .load(url)
                .resize(1500, 0)
                .placeholder(R.drawable.default_placeholder)
                .error(R.drawable.download_error)
                .into(imageViewPreview);

In the end, I was happy with the Glide version.

I hope this will be helpful to anyone that might be facing the same challenge.


I had issue while loading image from url into TouchImageView using Glide. It would show a black screen. I found a fix which works like this. Pass width and height in Glide override method and after setting bitmap call setZoom of TouchImageView with value 1.

Here is the complete code:

Glide.with('context')
                    .asBitmap()
                    .load('url')
                    .apply(new RequestOptions().override(1600, 1600)) //This is important 
                    .into(new BitmapImageViewTarget('imageview') {
                        @Override
                        public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                            super.onResourceReady(resource, transition);
                            'imageview'.setImageBitmap(resource);
                            'imageview'.setZoom(1); //This is important
                        }
                    });