title: Black screen when loading web image to Android
body: <p>When loading an image from the web I am getting a black screen.</p>
  
  <p>I took the page from the web turned it in to a canvas and then set it to the ImageView.</p>
  
  <p>Now when I load it I am getting a black screen in the image.</p>
  
  <p>Activity's code:</p>
  
  <pre><code>public class ImageActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          ImageView i = (ImageView) findViewById(R.id.imageView1);
  
          try {
              String url = "http://www.rotoworld.com/images/headshots/NBA/1372.jpg";
              Drawable image = ImageOperations(this, url);
              i.setImageDrawable(image);
          } catch (Exception ex) {
              ex.printStackTrace();
          }
          i.setMinimumWidth(22);
          i.setMinimumHeight(22);
  
          i.setMaxWidth(22);
          i.setMaxHeight(22);
  
      }
  
      private Drawable ImageOperations(Context ctx, String url) {
          try {
              InputStream is = (InputStream) this.fetch(url);
              Drawable d = Drawable.createFromStream(is, "src");
              return d;
          } catch (MalformedURLException e) {
              return null;
          } catch (IOException e) {
              return null;
          }
      }
  
      public Object fetch(String address) throws MalformedURLException, IOException {
  
          URL url = new URL(address);
          Object content = url.getContent();
          return content;
      }
  
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&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;TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="@string/hello" /&gt;
  
  &lt;ImageView
      android:id="@+id/imageView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/ic_launcher" /&gt;
  </code></pre>
  
  <p></p>