【发布时间】:2015-07-16 00:32:10
【问题描述】:
我正在使用 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);
}
我想知道谁负责回收此 Bitmap 或将其放回 Glide BitmapPool 中? Glide 似乎没有办法自动重用它或使用clear()。
我曾考虑使用 Glide.get(context).getBitmapPool().put(img) 之类的方式将位图直接添加回池中,但根据文档,直接使用位图池会导致未定义的行为。
【问题讨论】:
标签: android android-bitmap android-glide