title: Android : Load image from web URL
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3075637/loading-remote-images">Loading remote images</a>  </p>
  </blockquote>
  
  
  
  <p>I am developing an application where I have a list in which each row has an image,</p>
  
  <p>this image is loaded from a web URL.</p>
  
  <p>below is my code</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;ImageView
              android:id="@+id/list_row_img"
              android:layout_width="200dp"
              android:layout_height="200dp"
              /&gt;
  
      &lt;TextView
              android:id="@+id/list_row_description"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and this is the activity code</p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      ImageView img= (ImageView) findViewById(R.id.list_row_img);
      Bitmap bm = null;
      try {
           URL aURL = new URL("http://image10.bizrate-images.com/resize?sq=60&amp;uid=2216744464");
           URLConnection conn = aURL.openConnection();
           conn.connect();
           InputStream is = conn.getInputStream();
           BufferedInputStream bis = new BufferedInputStream(is);
           bm = BitmapFactory.decodeStream(bis);
           img.setImageBitmap(bm);
           bis.close();
           is.close();
  
           } catch (Exception e) {
              Log.v("EXCEPTION", "Error getting bitmap", e);
           }
  }
  </code></pre>
  
  <p>when I run i get nothing on the device. only a gray screen and no exception happens.</p>
  
  <p>note that i added this permission in the manifest file</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  </code></pre>
  
  <p>can anyone help me please ?</p>