title: Android: alert dialog in a class without activity
body: <p>i have this class:</p>
  
  <pre><code>public class DownloadImageTask extends AsyncTask&lt;String, Void, Bitmap&gt; {
  
  ImageFromWeb ifw;
  private String url;
  private final WeakReference&lt;ImageView&gt; imageViewReference;
  
  public DownloadImageTask(ImageView imageView) {
      imageViewReference = new WeakReference&lt;ImageView&gt;(imageView);
  }
  
  @Override
  protected Bitmap doInBackground(String... params) {
      url = params[0];
      try {
          return BitmapFactory.decodeStream(new URL(url).openConnection().getInputStream());
      } catch (MalformedURLException e) {
          e.printStackTrace();
          return null;
      } catch (IOException e) {
          e.printStackTrace();
          return null;
      }
  }
  
  @Override
  protected void onPostExecute(Bitmap result) {
      if (isCancelled()) {
          result = null;
      }
      if (imageViewReference != null) {
          ImageView imageView = imageViewReference.get();
          if (imageView != null) {
              imageView.setImageBitmap(result);
          }
      }
  }
  
  @Override
  protected void onPreExecute() {
      if (imageViewReference != null) {
          ImageView imageView = imageViewReference.get();
          if (imageView != null) {
   ---------&gt; imageView.setImageResource(R.drawable.pw);     
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and the main activity:</p>
  
  <pre><code>public class ImageFromWeb extends Activity {
  
  private String path = "http://....";
  private ImageView imageView;
  
  public void onCreate(Bundle bundle) {
      super.onCreate(bundle);
      setContentView(R.layout.main);
  
      ImageView mChart = (ImageView) findViewById(R.id.imview);
  
      mChart.setTag(path);
      new DownloadImageTask(mChart).execute(path);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I want to put in the point of arrow(in DownloadImageTask class) an alert dialog! How can i do this? Because this class isn't an activity. </p>
  
  <p>thanks :)</p>