获取加载了滑动的图像的文件路径
问题描述:
有人可以帮助我如何检索使用滑动缓存存储图像的文件路径?我想将加载了滑动的图像发送到服务器的图像视图。我可以知道如何获取缓存图像的文件路径吗?选择滑动缓存图像的原因是其上传到服务器的尺寸要小得多。获取加载了滑动的图像的文件路径
如果不可能有人可以建议压缩图像的方式?
我已经尝试过不同的图像压缩算法,但没有一个给出最好的滑动。
答
Glide支持SimpleTarget,它在加载完成时给出位图。
private SimpleTarget target = new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation glideAnimation) {
// upload bitmap here after saving it to your disk
}
};
然后使用目标作为
Glide
.with(context) // could be an issue!
.load(eatFoodyImages[0])
.asBitmap()
.into(target);
更多学习的https://futurestud.io/tutorials/glide-callbacks-simpletarget-and-viewtarget-for-custom-view-classes