How can I remove an alert dialog after a AsyncTask has done it's work
<p>I believe I'm doing this correctly, in my activity class I'm calling execute the alert dialog appears and then the data load but the alert dialog never goes away. Here is my AsyncTask code:</p>

<p>Followed by my activity code.</p>

<pre><code>public class Worker extends AsyncTask&lt;URL, Integer, Long&gt;{
private Activity ne;
private ProgressDialog progressDialog;
private Handler handler;


public Worker(Handler handler, Activity ne){
this.handler = handler;
this.ne = ne;

}

protected void onPreExecute() {
    progressDialog = ProgressDialog.show(ne,"", "Retrieving News Events", true);
}

protected void onProgressUpdate(Void... progress) {

}

protected void onPostExecute(Void result) {

    progressDialog.dismiss();
}

/* (non-Javadoc)
 * @see android.os.AsyncTask#doInBackground(Params[])
 */
@Override
protected Long doInBackground(URL... urls) {
HttpClient client = new DefaultHttpClient();
HttpGet get;

    try {
            get = new HttpGet(urls[0].toURI());
        ResponseHandler&lt;String&gt; response = new BasicResponseHandler();
        String responseBody = client.execute(get, response);


        String page = responseBody;

        Bundle data = new Bundle();

        data.putString("page",page);
        Message msg = new Message();
        msg.setData(data);

        handler.sendMessage(msg);

    }
    catch (Throwable t) {
        Log.d("UpdateNews", "PROBLEMS");
    }
return null;
}
</code></pre>

<p>}</p>

<pre><code>public class NewsEvents extends ListActivity{
private URL JSONNewsEvents;
private ArrayList&lt;NewsEvent&gt; neList;
private ArrayList&lt;String&gt; keyWordList;
private Worker worker;
private TextView selection;
private ProgressDialog progressDialog;
static final int PROGRESS_DIALOG = 0;
public static final String KEYWORDS = "keywords";
private NewsEvents ne;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.newsevents);
    ne = this;
    neList = new ArrayList&lt;NewsEvent&gt;();
selection=(TextView)findViewById(R.id.selection);

    try {
    JSONNewsEvents = new URL(getString(R.string.jsonnewsevents));
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

    worker = new Worker(handler, this);

    setListAdapter(new IconicAdapter());
    getKeywords(); 
    worker.execute(JSONNewsEvents);


}

/**
 * @return
 */

public ArrayList&lt;String&gt; getKeywords(){
try {
    InputStream fi = openFileInput(KEYWORDS);

    if (fi!=null) {
        ObjectInputStream in = new ObjectInputStream(fi);
                keyWordList = (ArrayList&lt;String&gt;) in.readObject();
                in.close();
    }
}
catch (java.io.FileNotFoundException e) {
    // that's OK, we probably haven't created it yet
}
catch (Throwable t) {
    Toast
        .makeText(this, "Exception: "+t.toString(), Toast.LENGTH_LONG)
        .show();
}
if(keyWordList == null){
    keyWordList = new ArrayList&lt;String&gt;();
    return keyWordList;
}

return keyWordList;
}

public void onListItemClick(ListView parent, View v,
    int position, long id) {
startFullNewsEvent(neList.get(position));
}

/**
 * @param newsEvent
 */
public void startFullNewsEvent(NewsEvent ne) {
Intent intent = new Intent(this, FullNewsEvent.class);
intent.putExtra("ne", ne);
this.startActivity(intent);
finish();
}



private Handler handler = new Handler(){
    @Override
    public void handleMessage(Message msg) {
        String page = msg.getData().getString("page");



        try {  
           JSONArray parseArray = new JSONArray(page);  

           for (int i = 0; i &lt; parseArray.length(); i++) {  
               JSONObject jo = parseArray.getJSONObject(i);  

               String title = jo.getString("title");  

               String body =jo.getString("body");

               String pd = jo.getString("postDate");  

               String id = jo.getString("id");


               NewsEvent ne = new NewsEvent(title, pd , body, id);

               boolean unique = true;
               for(NewsEvent ne0 : neList){
               if(ne.getId().equals(ne0.getId())){
                  unique = false;
               }else{
                   unique = true;
               }
               }

               if(unique == true){
               neList.add(ne);
               }
           }  
          } catch (JSONException e) {  
           // TODO Auto-generated catch block  
           e.printStackTrace();  
          }
          ne.setListAdapter(new IconicAdapter());

    }
};

public class IconicAdapter extends ArrayAdapter&lt;NewsEvent&gt; {
IconicAdapter() {
    super(NewsEvents.this, R.layout.rownews, neList);
}

public View getView(int position, View convertView,ViewGroup parent) {
    LayoutInflater inflater=getLayoutInflater();

    View row=inflater.inflate(R.layout.rownews, parent, false);
    TextView label=(TextView)row.findViewById(R.id.label);
    ImageView image= (ImageView)row.findViewById(R.id.icon);

    String body = neList.get(position).getBody();
    body.replaceAll("\\&lt;.*?&gt;", "");
    String title = neList.get(position).getTitle();
    for(String s : keyWordList){
        if(body.contains(s) || body.contains(s.toLowerCase()) ||
            title.contains(s) || title.contains(s.toLowerCase())){
        neList.get(position).setInterested(true);
        }
    }

    if(neList.get(position).isInterested() == true){
        image.setImageResource(R.drawable.star);
    }


    label.setText(neList.get(position).getTitle());

    return(row);
}
}
</code></pre>

<p>}</p>
