我正在尝试将图像从 url 保存到带有离子库的新文件中。但什么也没有发生。有人可以帮我吗?
Ion.with(mContext)
.load("someUrl")
.write(new File(mContext.getCacheDir(), "123.jpg"));
我正在尝试将图像从 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
}
});
Ion is asynchronous. Use .setCallback to get a callback when it completes.
Ion.with(mContext)
.load("someUrl")
.write(new File(mContext.getCacheDir(), "123.jpg"));
.setCallback(....)