在下面的代碼:的Android ProgressDialog沒有顯示
Log.v("dialog", "dialogshow");
ProgressDialog dialog = ProgressDialog.show(UBActivity.this, "", "Loading calendar, please wait...", true);
boolean res;
try {
res = new Utils().new DownloadCalendarTask().execute().get();
} catch (InterruptedException e) {
Log.v("downloadcalendar", "interruptedexecution : " + e.getLocalizedMessage());
res = false;
} catch (ExecutionException e) {
Log.v("downloadcalendar", "executionexception : " + e.getLocalizedMessage());
res = false;
}
Log.v("dialog", "dialogdismiss");
dialog.dismiss();
根據logcat的有dialogshow和dialogdismiss在日誌中顯示之間8秒的差別,但我沒有看到ProgressDialog出現在所有。後臺操作不在UI線程中發生(這是一個AsyncTask),所以不應該是問題?
非常感謝ü
AsyncTask <>的代碼是什麼樣的?你在'onPreExecute'上做了很多工作嗎? –