1)我通过AsyncTask启动了一个后台任务
new FindJourneyTask().execute(); // FindJourneyTask extends AsyncTask
2) 在主线程中 (在新线程启动之前),我使用showDialog(dialogId)创建一个对话框
// this method is in FindJourneyTask
protected void onPreExecute() {
showDialog(DIALOG_FINDING_JOURNEY);
}
3) 屏幕方向改变时,Activity将重新创建
4) 我现在该如何关闭FindJourneyTask中的对话框?调用dismissDialog(dialogId)没有任何反应。
// this method is in FindJourneyTask
protected void onPostExecute(FindJourneyResult result) {
dismissDialog(DIALOG_FINDING_JOURNEY); // does nothing
}