`

You should implement this support yourself (BaseImageDownloader.getStreamFromOth

阅读更多

今天想利用本地图片资源的Uri来使用ImageLoader加载图片

结果报了这么一个错误:

You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))

 

09-29 20:11:36.653 27465-27684/com.deltalab.urecommend E/ImageLoader: UIL doesn't support scheme(protocol) by default [/storage/sdcard/female.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
                                                                      java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [/storage/sdcard/female.jpg]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
                                                                          at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:280)
                                                                          at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:99)
                                                                          at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291)
                                                                          at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274)
                                                                          at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230)
                                                                          at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
                                                                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                          at java.lang.Thread.run(Thread.java:818)

 

在经过了一些博客的指点之后我总结了一下:

 

不同的路径有不同的方法,如果是在assets里,则在路径前加上“assets://”

 

还有以下情况:

    String imageUri = "http://site.com/image.png"; // from Web  
    String imageUri = "file:///mnt/sdcard/image.png"; // from SD card  
    String imageUri = "content://media/external/audio/albumart/13"; // from content provider  
    String imageUri = "assets://image.png"; // from assets  
    String imageUri = "drawable://" + R.drawable.image; // from drawables (only images, non-9patch)  

 

实例:

 

android如何获取一个SD卡指定文件夹的图片Uri:

String a="file://"+Environment.getExternalStorageDirectory().getPath()+"/DCIM/Camera/";

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics