[英]Ion koush library
我正在尝试将图像从url保存到带有离子库的新文件中。 但是什么也没发生。 有人可以帮我吗?
Ion.with(mContext)
.load("someUrl")
.write(new File(mContext.getCacheDir(), "123.jpg"));
使用通用图像加载器
你可以做到
ImageLoader imageLoader = ImageLoader.getInstance(); // Get singleton instance
// Load image, decode it to Bitmap and return Bitmap to callback
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage){
// Do whatever you want with Bitmap
}
});
离子是异步的。 使用.setCallback获取完成时的回调。
Ion.with(mContext)
.load("someUrl")
.write(new File(mContext.getCacheDir(), "123.jpg"));
.setCallback(....)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.