title: Display image from URL - sizing and screen orientation problems
body: <p>I am trying to display an image from a URL, which may be larger than the screen dimensions.  I have it kind of working, but I would like it to scale to fit the screen, and I also have problems when the screen orientation changes.  The image is tiny, and I would like it to scale its width to the screen as well.  (In both cases, I would like the image to fill the screen width with scrollbars (if necessary for height).</p>
  
  <p>Here is my ImageView:</p>
  
  <pre><code>&lt;ImageView android:id="@+id/ImageView01" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:scaleType="fitCenter"
      android:adjustViewBounds="true"&gt;
  &lt;/ImageView&gt;
  </code></pre>
  
  <p>Here is the java code which loads the image: (some error handling code removed for simplicity)</p>
  
  <pre><code>    Object content = null;
      try{
        URL url = new URL("http://farm1.static.flickr.com/150/399390737_7a3d508730_b.jpg");
        content = url.getContent();
      }
        catch(Exception ex)
      {
          ex.printStackTrace();
      }
      InputStream is = (InputStream)content;
      Drawable image = Drawable.createFromStream(is, "src");
      Image01.setImageDrawable(image);
  </code></pre>
  
  <p>I have tried different settings for android:scaleType.  I'm sorry if this question has been asked before.  I've gone through a number of tutorials on the subject, but they don't seem to work for me.  Not sure if it has anything to do with the way the image is loaded. (from the web instead of a local resource)</p>
  
  <p>Another issue is that sometimes the image doesn't even load.  There are no runtime errors, I just get nothing in the ImageView.</p>
  
  <p>Please let me know if you need more information or clarification.</p>