AsyncTask not calling onProgressUpdate and onPostExecute
<p>I am doing a android app which have a function to download the image while i clicked on the imageview. I have used Asynctask to start a new thread for downloading.However, the onProgressUpdate and onPostExecute method are never called. i have attached my codes.
The following is my code for main activity:</p>

<pre><code>public void onClick(View v) {
            String uri = "";
            if(!event.hasImage1())
            {
                uri = Configuration.SERVER_IP + "/" +event.getImgLink1();
                ImageDownloadTask task = new ImageDownloadTask(imageView1, StaffViewEventActivity.this);
                task.execute(uri);  
            }
        }
    });
</code></pre>

<p>Then this is my code for Asyntask class:</p>

<pre><code>public class ImageDownloadTask extends AsyncTask&lt;String, Integer, Bitmap&gt; {

private static String TAG = "ImageDownloadTask";
private ImageView imageView;
private StaffViewEventActivity activity;

@Override
protected Bitmap doInBackground(String... params) {
    Log.i(TAG, "doInBackground:" + params[0]);
    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(params[0]);
    InputStream is = null;
    ByteArrayOutputStream baos = null;
    try {
        HttpResponse httpResponse = httpClient.execute(httpGet);
        HttpEntity httpEntity = httpResponse.getEntity();
        long length = httpEntity.getContentLength();
        Log.i(TAG, "start downloading image");
        is = httpEntity.getContent();
        if (is != null) {
            baos = new ByteArrayOutputStream();
            byte[] buf = new byte[128];
            int read = -1;
            int count = 0;
            while ((read = is.read(buf)) != -1) {
                baos.write(buf, 0, read);
                count += read;
                publishProgress((int)(count * 1.0f / length));
            }

            byte[] data = baos.toByteArray();
            Bitmap bit = BitmapFactory.decodeByteArray(data, 0,  

                             data.length);
            Log.i(TAG, "finish downloading image");
            return bit;
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            if (baos != null) {
                baos.close();
            }
            if (is != null) {
                is.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return null;
}

public ImageDownloadTask(ImageView imageView, StaffViewEventActivity activity)
{
    this.imageView = imageView;
    this.activity =activity;
}

@Override
protected void onProgressUpdate(Integer... progress) {
    Log.i("DownloadImgTask", "progress:" + progress[0]);
    //photoView.setProgress(progress[0]);                
}

@Override
protected void onPostExecute(Bitmap result) {
    Log.i(TAG, "onPostExecute");
    super.onPostExecute(result);
    imageView.setImageBitmap(result);
    activity.updateImageStatus(imageView.getId());
}

@Override
protected void onCancelled() {
    Log.i(TAG, "DownloadImgTask cancel...");
    super.onCancelled();
}


}
</code></pre>

<p>The doInBackground method is running and i can get the image through 
    task.execute(uri).get();
But i cannot get my onProgressUpdate and onPostExecute called. Can any1 help me with this problems, really appreciated.</p>
