今天想利用本地图片资源的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/";
相关推荐
You may either implement a FlowIndicator yourself or use an implementation provided by the View Flow library. The View Flow library currently supports the following indicators: Circle Flow Indicator...
Note: If you use a symbol Foo in your source file, you should bring in a definition for Foo yourself, either via an #include or via a forward declaration. Do not depend on the symbol being brought in ...
the JavaMail API, if you want this type of information, you have to calculate it yourself. IMAP IMAP is a more advanced protocol for receiving messages. Defined in RFC 2060 , IMAP stands for ...
Upon purchasing the 1100H+, you should have received the following items: - Tester unit - User manual (this document) - Necessary cables and adapters for basic operations - Printer (if included as an...
Tell me something about yourself. **Note**: This question is not directly related to technical knowledge but rather a common interview question. For the purpose of this document, we will focus on ...
While these examples are not replacement for a proper documentation, they should be enough to get started quickly and to see the magic of reinforcement learning yourself. I also encourage you to play ...