2014-07-20 121 views
0

你好我嘗試使用UIL本地操作系統畫廊加載圖像,並以下URI:UIL:從外部存儲負載圖像

/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(...)) 

任何建議如何我加載這樣的圖像?

+0

請看這裏:[Android - 更好的方法在加載SD卡圖像](http://stackoverflow.com/questions/17420664/android-better-better-approach-in-loading-sd-card-images) –

回答

-1

嘗試下面的格式,

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

在UIL如果從SD卡加載圖像,你應該使用前綴文件:///

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

已經嘗試它,得到: 無法解碼流:java.io.FileNotFoundException:/file:/storage/emulated/0/DCIM/Camera/IMG_20140713_103602.jpg:打開失敗:ENOENT(沒有這樣的文件或目錄) 07-21 09:55:15.850 22038-22662/com.autodesk.autocad360.cad.staging D/Sean9:getCurrentHub,mCurrentHub null?假 –

+0

@EvgeniRoitburg您是否添加了許可「<使用權限android:name =」android.permission.WRITE_EXTERNAL_STORAGE「/> 」 –

+0

它顯而易見,已經有了它。 –