title: Android image view from url
body: <p>I am downloading an image from url, but the image is not changed after the download is complete.
  I am entering code below, anybody experienced the same?</p>
  
  <p><code>Java</code> file</p>
  
  <pre><code>public class MyImgActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      ImageView imgView =(ImageView)findViewById(R.id.imageView1);
      Drawable drawable = LoadImageFromWebOperations("http://www.gophoto.it/view.php?i=http://1.bp.blogspot.com/-2LTvCCufBKc/T3L3KgcTj2I/AAAAAAAABbQ/Ki60e1LU9sE/s1600/Sachin%2BTendulkar.png");
  
      imgView.setImageDrawable(drawable);
   }
  private Drawable LoadImageFromWebOperations(String url) {
      try
        {
         InputStream is = (InputStream) new URL(url).getContent();
         Drawable d = Drawable.createFromStream(is, "src name");
         return d;
        }catch (Exception e) {
         System.out.println("Exc="+e);
         return null;
        }
  }
  }
  </code></pre>
  
  <p><code>XML</code> file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;ImageView 
      android:id="@+id/imageView1"
      android:layout_height="match_parent" 
      android:layout_width="match_parent"&gt;&lt;/ImageView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><code>Manifest</code> file</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  </code></pre>