title: java.io.IOException: BufferedInputStream is closed
body: <p>I'm trying to load images from url in a listview in android. I'm using below piece of code to do that.</p>
  
  <pre><code>        Bitmap bm;
          try {
              URL url = new URL(imageUrl);
              bm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
          } catch (Exception e) {
              Log.e("Error", e.getMessage());
              e.printStackTrace();
          }
          imageView.setImageBitmap(bm);
  </code></pre>
  
  <p>I'm executing the above code in an AsyncTask. When i execute, it displays correctly. But after i move to another activity and come back the image is not displaying. At that time my logcat shows,</p>
  
  <pre><code>W/System.err(3570): java.io.IOException: BufferedInputStream is closed
  W/System.err(3570):     at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:116)
  W/System.err(3570):     at java.io.BufferedInputStream.read(BufferedInputStream.java:274)
  W/System.err(3570):     at org.apache.harmony.luni.internal.net.www.protocol.http.UnknownLengthHttpInputStream.read(UnknownLengthHttpInputStream.java:40)
  W/System.err(3570):     at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:166)
  W/System.err(3570):     at java.io.BufferedInputStream.read(BufferedInputStream.java:324)
  W/System.err(3570):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
  W/System.err(3570):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:573)
  W/System.err(3570):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:628)
  W/System.err(3570):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
  W/System.err(3570):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
  W/System.err(3570):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  W/System.err(3570):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
  W/System.err(3570):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  W/System.err(3570):     at java.lang.Thread.run(Thread.java:1019)
  </code></pre>
  
  <p>Actually the error is showing in below line,</p>
  
  <pre><code>bm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
  </code></pre>
  
  <p>I've Searched and find different posts related to this in SO, but couldn't find any solution...
  Can anyone help me out?</p>