public static Bitmap netImgToBitmap(String url) { URL mUrl = null; Bitmap bitmap = null; try { mUrl = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) mUrl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream inputStream = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(inputStream); inputStream.close(); } catch (IOException e) { e.printStackTrace(); } return bitmap; }