`
zhujianjia
  • 浏览: 478767 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

已经知道图片的URL,获取图片

 
阅读更多

 

已经知道图片的URL,获取图片

 

private Bitmap getURLBitmap(String imageURL){
    	Bitmap bitmap = null;
    	try {
			URL url_im = new URL(imageURL);
			HttpURLConnection conn = (HttpURLConnection)url_im.openConnection();
			conn.connect();
			InputStream is = conn.getInputStream();
			bitmap =BitmapFactory.decodeStream(is);
			is.close();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bitmap;
    }
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics