簡體   English   中英

離子庫什圖書館

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM