title: Android: cannot resolve method 'findViewById(int)' in AsyncTask
body: <p>Following the tutorial <a href="http://www.peachpit.com/articles/article.aspx?p=1823692&amp;seqNum=3" rel="nofollow">here</a> I have set up an app that should be able to download an image from a URL and place it into an ImageView.  The only issue is that it cannot find findViewById because it is in the Activity class instead of the AsyncTask class. code is here:</p>
  
  <pre><code>package com.example.weather2;
  import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.os.AsyncTask;
  import android.util.Log;
  import android.widget.ImageView;
  
  import java.io.InputStream;
  import java.net.HttpURLConnection;
  import java.net.URL;
  
  
  public class ImageDownloader
          extends AsyncTask&lt;String, Integer, Bitmap&gt; {
  protected void onPreExecute(){
      //Setup is done here
  }
  @Override
  protected Bitmap doInBackground(String... params) {
      //TODO Auto-generated method stub
      try{
          URL url = new URL(params[0]);
          HttpURLConnection httpCon =
                  (HttpURLConnection)url.openConnection();
          if(httpCon.getResponseCode() != 200)
              throw new Exception("Failed to connect");
          InputStream is = httpCon.getInputStream();
          return BitmapFactory.decodeStream(is);
      }catch(Exception e){
          Log.e("Image", "Failed to load image", e);
      }
      return null;
  }
  protected void onProgressUpdate(Integer... params){
      //Update a progress bar here, or ignore it, I didn't do it
  }
  protected void onPostExecute(Bitmap img){
      ImageView iv = (ImageView) findViewById(R.id.imageView); //here is where the issue is
      if(iv!=null &amp;&amp; img!=null){
          iv.setImageBitmap(img);
      }
  }
  protected void onCancelled(){
  }
  }
  </code></pre>
  
  <p>When I comment out the lines with the issue, I don't get any errors, which makes me think it is working, but I can't tell because there is no image being posted.
  Any help for solving this issue would be much appreciated.</p>