在下面的代码:的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'上做了很多工作吗? –