Glide not loading image from memory at the first time when rotating (orientation change), and after that it is loading from memory.
I have tried to increase the memory size, the bitmap pool size, all kinds of caching strategies... nothing seemed to work...
I have attached a video.
https://youtu.be/szDnAGxrJLU
Thanks!
.dontAnimate()
adding this to Glide solved my problem
Glide.with(view.getContext())
.load(url)
.placeholder(placeholder_image_crop))
.dontAnimate()
.into(view)
You may face this issue because of
CircleImageView/CircularImageView/RoundedImageView
are known to have issues with TransitionDrawable
(.crossFade() with .thumbnail() or .placeholder()) and animated GIFs
, use a BitmapTransformation
(.circleCrop() will be available in v4) or .dontAnimate()
to fix the issue.
for more queries refer following links it may help you. link 1 and link 2
Your ImageView
s don't have the exact same size in portrait and in landscape and you are probably using fitCenter()
or centerCrop()
to resize the image to the ImageView
size. When you change orientation, Glide loads the full-sized image from cache but it has to resize it on a background thread first before display, that's why you see a delay after the first orientation change. After resized images for both portrait and landscape are in the memory cache, there is no more delay.
Just to emphasize what is written above and add a solution.
It is possible to change the disk caching strategy to cache the source image but not the memory caching strategy, in that case it will not hit unless it is the same size.
What i did was use .override(width,height) in order to override this strategy and keep the source image in the memory cache.
Glide.with(context)
.load(imgUrl)
.crossFade()
.override(imageWidth,imageHeight)
.into(imgView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With