0
我在AsyncTask中使用progressDialog,但它不顯示progressDialog,它也跳過框架。下面是日誌:跳過框架,不顯示progressdialog
05-09 00:09:41.958: E/pass 1(16031): Connection success
05-09 00:09:41.968: E/pass 2(16031): Result: Success!
05-09 00:09:41.978: I/System.out(16031): Out background...
05-09 00:09:41.978: I/Choreographer(16031): Skipped 56 frames! The application may be doing too much work on its main thread.
05-09 00:09:42.008: I/System.out(16031): In onPostExecute...
05-09 00:09:42.018: I/System.out(16031): Committed.
05-09 00:09:42.018: I/System.out(16031): Out onPostExecute...
這裏是代碼:
protected void onPreExecute() {
progressDialog = ProgressDialog.show(NewNote.this, "", "");
progressDialog.setCancelable(false);
progressDialog.setContentView(R.layout.progressdialog);
progressDialog.show();
}
protected Void doInBackground(Void... params) {
System.out.println("In background...");
//connecting to the internet and saving the shared preference
System.out.println("Out background...");
return null;
}
protected void onPostExecute(Void result) {
System.out.println("In onPostExecute...");
progressDialog.dismiss();
System.out.println("Committed.");
setResult(RESULT_OK, data);
finish();
System.out.println("Out onPostExecute...");
}
爲什麼progressDialog沒有顯示?
謝謝。
你可以包含用於調用'AsyncTask'的代碼嗎? – ianhanniballake
啊是的,我有'task.execute()。get();'。謝謝! –
也許它太快? 如何創建progressdialog? 看起來它: http://stackoverflow.com/questions/9814821/show-progressdialog-android – idelcano