img01 = (ImageView)findViewById(R.id.img01);
String urlStr = "D:/workspace/May15_URL_Image/assets/pc.png";
try {
URL url = new URL(urlStr);
URLConnection urlConn = url.openConnection();
InputStream in = urlConn.getInputStream();
Bitmap bm = BitmapFactory.decodeStream(in);
img01.setImageBitmap(bm);
} catch (Exception e) {
e.printStackTrace();
}
这里的urlStr路径我直接显示到照片的盘符位置,为什么在手机上跑的时候却显示不出来呢???
也不见报错呀,请各位大大指点一下。
谢谢。
String urlStr = "D:/workspace/May15_URL_Image/assets/pc.png";
try {
URL url = new URL(urlStr);
URLConnection urlConn = url.openConnection();
InputStream in = urlConn.getInputStream();
Bitmap bm = BitmapFactory.decodeStream(in);
img01.setImageBitmap(bm);
} catch (Exception e) {
e.printStackTrace();
}
这里的urlStr路径我直接显示到照片的盘符位置,为什么在手机上跑的时候却显示不出来呢???
也不见报错呀,请各位大大指点一下。
谢谢。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货