Reputation: 49
I'm using Glide v3.8.0 (not v4) to load Image in to ImageView in an item of RecyclerView, and there is a bit problems: every time scroll the RecyclerView up or down, Glide load the Image into ImageView that already been loaded before, and the bad result is scroll is not smooth because it keep reload Image every time I scroll to, I don't want to reload an image that completely loaded. I have found some same questions but still have no right answer to this problem
This is my code to load image into RecyclerView item
Glide.with(mContext).load(function.BitmapToByte(function.GetBitmap(currSong.getData())))
.diskCacheStrategy(DiskCacheStrategy.ALL).error(R.drawable.noteicon).into(holder.coverimg);
Upvotes: 4
Views: 2582
Reputation: 145
I had this problem and i fixed it using
recyclerview.setItemViewCacheSize(50);
This way not all old items will be recycled
Upvotes: 0
Reputation: 1139
Try load it by file name Use something like string varible so let glide know that the same image loaded before
Upvotes: 0