Show dialog when activity changes
<p>I use activity A to start background download using <code>AsyncTask</code>, when download finished, <code>AsyncTask.postExecute</code> will popup a <code>AlertDialog</code>. However, during download, I switch to another Activity B <strong>or any other activities</strong>. The result is that the <code>AlertDialog</code> can't show out. <code>AlertDialog</code> uses activity context(Here should be A). So, how can I show out the <code>AlertDialog</code>? </p>

<pre><code>AlertDialog.Builder builder = new  AlertDialog.Builder(context);
builder.setMessage(context.getString(R.string.install));
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener()
{
    @Override
    public void onClick(DialogInterface dialog, int which)
    {
        //onSure();
    }
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener()
{
    @Override
    public void onClick(DialogInterface dialog, int which)
    {
        //onCancle();
    }
});

builder.create().show();
</code></pre>
