小编Ang*_*ton的帖子

使用负责回收的Glide加载Bitmap时?

我正在使用Glide加载位图来创建一个gif.

     for (int i = 0, count = files.size(); i < count; i++) {
         Bitmap img = Glide.with(context)
             .load(files.get(i))
             .asBitmap()
             .centerCrop()
             .into(GIF_EXPORT_SIZE / 2, GIF_EXPORT_SIZE / 2)
             .get();

         // addFrame creates a copy of img, so we can re-use this bitmap
         encoder.addFrame(img);
    }
Run Code Online (Sandbox Code Playgroud)

我想知道谁负责回收这个Bitmap或者把它放回到Glide BitmapPool中?Glide似乎没有办法自动或通过使用来重复使用它clear().

我看着使用类似的东西直接将Bitmap添加回池中,Glide.get(context).getBitmapPool().put(img)但根据使用BitmapPool的文档直接导致未定义的行为.

android android-bitmap android-glide

5
推荐指数
1
解决办法
1597
查看次数

标签 统计

android ×1

android-bitmap ×1

android-glide ×1