image issue on android
<p>I am downloading image from url and set to Imageview.but sometime the bitmap returns null?
why this happened?..
My code is</p>

<pre><code>Bitmap bm = null;
URL myFileUrl =null;          
    try 
    {
         myFileUrl= new URL(url);
    }
    catch (MalformedURLException e) 
    {
         // TODO Auto-generated catch block
         e.printStackTrace();
    }
    try 
    {
         HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
         conn.setDoInput(true);
         conn.connect();
         int length = conn.getContentLength();
         InputStream is = conn.getInputStream();
         bm = BitmapFactory.decodeStream(is);

    } 
    catch (IOException e) 
    {
         // TODO Auto-generated catch block
         e.printStackTrace();
    }
    return bm;
</code></pre>
