Below is the code to help you read the image. But remember that if you do this in UI Thread, then it depends on the user interface. You should always open a new stream and load the image into this stream. Therefore, your application always remains responsive.
InputStream is = null; BufferedInputStream bis = null; Bitmap bmp = null; try { URLConnection conn = url.openConnection(); conn.connect(); is = conn.getInputStream(); bis = new BufferedInputStream( is ); bmp = BitmapFactory.decodeStream( bis ); } catch (MalformedURLException e) { } catch (IOException e) { } finally { try { is.close(); bis.close(); } catch (IOException e) { } } imageView.setImageBitmap( bmp );
source share