Handling Glide image load failed
suggest changeGlide .with(context) .load(currentUrl) .into(new BitmapImageViewTarget(profilePicture) { @Override protected void setResource(Bitmap resource) { RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), resource); circularBitmapDrawable.setCornerRadius(radius); imageView.setImageDrawable(circularBitmapDrawable); } @Override public void onLoadFailed(@NonNull Exception e, Drawable errorDrawable) { super.onLoadFailed(e, SET_YOUR_DEFAULT_IMAGE); Log.e(TAG, e.getMessage(), e); } });
Here at SET_YOUR_DEFAULT_IMAGE
place you can set any default Drawable
. This image will be shown if Image loading is failed.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents