首先,你應該在你的URI開頭添加http://
:
Uri uri = Uri.parse("http://www.dha.com.tr/newpics/news/230620111356175716857.jpg");
ImageView
不從遠程位置支持加載圖像。只有本地文件系統上的資源或文件。在你的情況,你應該看到LogCat
警告:
06-23 15:19:52.487: WARN/System.err(27097): java.io.FileNotFoundException: /http:/www.dha.com.tr/newpics/news/230620111356175716857.jpg (No such file or directory)
06-23 15:19:52.503: WARN/System.err(27097): at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
06-23 15:19:52.503: WARN/System.err(27097): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
06-23 15:19:52.503: WARN/System.err(27097): at java.io.FileInputStream.<init>(FileInputStream.java:82)
06-23 15:19:52.503: WARN/System.err(27097): at java.io.FileInputStream.<init>(FileInputStream.java:134)
06-23 15:19:52.503: WARN/System.err(27097): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:349)
06-23 15:19:52.503: WARN/System.err(27097): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:399)
06-23 15:19:52.503: WARN/System.err(27097): at android.graphics.drawable.Drawable.createFromPath(Drawable.java:801)
06-23 15:19:52.503: WARN/System.err(27097): at android.widget.ImageView.resolveUri(ImageView.java:516)
06-23 15:19:52.503: WARN/System.err(27097): at android.widget.ImageView.setImageURI(ImageView.java:293)
...
06-23 15:19:52.503: WARN/System.err(27097): at dalvik.system.NativeStart.main(Native Method)
06-23 15:19:52.503: INFO/System.out(27097): resolveUri failed on bad bitmap uri: http://www.dha.com.tr/newpics/news/230620111356175716857.jpg
你應該自己下載的圖像,然後指定setImageURI
本地路徑。
哇。看起來幾乎像彙編語言 – user275801