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; }
原文:http://www.cnblogs.com/zhujiabin/p/7872396.html