首页 > 移动平台 > 详细

Android根据URL获取Bitmap

时间:2015-01-13 13:51:43      阅读:397      评论:0      收藏:0      [点我收藏+]

为了方便记忆,写下。

 s为url

需要添加网络权限,还有开启子线程访问网络
public Bitmap getBitmap(String s)
{
Bitmap bitmap = null;
try
{
URL url = new URL(s);
bitmap = BitmapFactory.decodeStream(url.openStream());
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

return bitmap;
}

}

Android根据URL获取Bitmap

原文:http://www.cnblogs.com/aidonglei/p/4220917.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!