Android 将图片网址url转化为bitmap

采得百花成蜜后,为谁辛苦为谁甜。这篇文章主要讲述Android 将图片网址url转化为bitmap相关的知识,希望能为你提供帮助。

public Bitmap returnBitMap(final String url){new Thread(new Runnable() { @Override public void run() { URL imageurl = null; try { imageurl = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection)imageurl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(is); is.close(); } catch (IOException e) { e.printStackTrace(); } } }).start(); return bitmap; }

【Android 将图片网址url转化为bitmap】 

    推荐阅读