UIL:从外部存储加载图像

时间:2014-07-20 14:49:23

标签: android universal-image-loader

我正在尝试使用UIL和以下uri从本机OS库加载图像:

/storage/emulated/0/DCIM/Camera/IMG_20140713_103602.jpg

我得到了:

UIL doesn't support scheme(protocol) by default [/storage/emulated/0/DCIM/Camera/IMG_20140713_103602.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
    java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [/storage/emulated/0/DCIM/Camera/IMG_20140713_103602.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))

有任何建议我如何加载这样的图像?

2 个答案:

答案 0 :(得分:4)

在UIL中如果要从SDCARD加载图像,则应使用前缀 file:/// 作为

  String imageUri = "file:///mnt/sdcard/image.png"; // from SD card

 "file:///"+Environment.getExternalStorageDirectory().toString()
                + File.separator + "image.png";

因此请使用图像路径

file:///storage/emulated/0/DCIM/Camera/IMG_20140713_103602.jpg

答案 1 :(得分:-1)

请尝试以下格式

String imageUri = "file:///mnt/sdcard/image.png"; // from SD card