Why is this image bitmap not downloading in Android?
<p>I have an appliation in which I have to download an image from an URL. I am using the following code for the same: </p>

<pre><code>URL url = new URL(address);
URLConnection conn = url.openConnection();
conn.connect();
int length = conn.getContentLength();
is = conn.getInputStream();
bis = new BufferedInputStream(is, length);
bm = BitmapFactory.decodeStream(bis);
</code></pre>

<p>The bm which is returned for some reason has height and width -1, and this is throwning Illegal state exception. What could be the reason that height and width is coming -1?</p>
