Reputation: 901
I have a list of image views and some of them will be frequently updated with a fixed url. By appending a timestamp query parameter in the end of the url. It works, but I found when it updates it will also clear the current content. Any way to prevent this?
// the one needed to update with timestamp appended
image += "?"+String.valueOf(System.currentTimeMillis());
Glide.with(mContext.getApplicationContext())
.load(image)
.error(R.drawable.default_avatar)
.centerCrop()
.crossFade()
.into(((VideoViewHolder) holder).img);
// the others don't need to update
Glide.with(mContext.getApplicationContext())
.load(image)
.error(R.drawable.default_avatar)
.centerCrop()
.crossFade()
.into(((VideoViewHolder) holder).img);
Note that the others without timestamp appended are all good.
Upvotes: 7
Views: 5533
Reputation: 3976
Try this
Glide
.with(context)
.load(filepath)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.dontAnimate()
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap arg0, GlideAnimation<? super Bitmap> arg1) {
// TODO Auto-generated method stub
holder.mItemView.setImageBitmap(arg0);
}
});
If you're using Glide 3.x and wish to directly display the image without the small crossfade effect, call .dontAnimate() on the Glide request builder: for more read this : Glide — Placeholders & Fade Animations
Happy coding!!
Upvotes: 4
Reputation: 1001
If you are using Emulator, then this can happens. Try using a real physical device or change the emulator.
Upvotes: -3