title: How to set image from Url using AsyncTask?
body: <p>I'm a newbie programmer an I'm making an android program that displays an image on ImageView from a given url. My problem is how do you use this on the AsyncTask?</p>
  
  <p>These codes work on min SDK 2.2 but I switched to min SDK 3.0 so it needs to run on the AsyncTask. Thank you for your help! :)</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      satellite(); //satellite's image from main menu
  
  }
  
  //******satellite url
  private void satellite() {
      // TODO Auto-generated method stub
      ImageView imgView =(ImageView)findViewById(R.id.satellite);
      Drawable drawable = LoadImageFromWeb("http://www.pagasa.dost.gov.ph/wb/sat_images/satellite.gif");
      imgView.setImageDrawable(drawable);        
  }
  
  private Drawable LoadImageFromWeb(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>