Reputation: 1178
I am displaying GIFs in a RecyclerView. Code:
Glide.with(acitivity)
.load(url)
.placeholder(R.drawable.image_placeholder)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.listener(listener)
.into(viewHolder.imageView);
If I keep the Fragment containing this RecyclerView open, very high amount of CPU (~40%) is used by the app. And the phone heats up if I use the Fragment for 1-2 minutes. Is it normal for GIFs? Am I doing anything wrong here?
Upvotes: 4
Views: 1475
Reputation: 1178
Got response from Glide contributors on Github. Here is what they say -
High CPU consumption is normal. Glide does this to save memory and eventually the evil OOM Exceptions.
Suggestions -
- Use static
Bitmap
image for preview, avoid auto-play.- Use timeout or
setLoopCount
onGlideDrawable/GifDrawable
More: https://github.com/bumptech/glide/issues/1029
Edit:
Check this issue if you are using ViewPager: https://github.com/bumptech/glide/issues/1028
Upvotes: 3