首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android显示图片如何做?

2012-06-05 
android显示图片怎么做????????????????????调用web service 返回一段话hello world!! img srchttp://w

android显示图片怎么做????????????????????
调用web service 返回一段话


hello world!! <img src="http://www.xxx.com/hello.jpg">


然后把这段话存入map

map.put("con",html);

然后弄到适配器,并送到GridView显示

但是显示出来还是这句话,,如何显示图片

是否要在map.put("con",html);这个操作之前有啥处理?????


需要代码解释

[解决办法]

/**
* 从网络上下载

* @param url
* @return
*/
public static Bitmap getBitMapFromUrl(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;
try {
myFileUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}

热点排行