0

我有 AsynTask 并在它运行时显示进度对话框。电话接听来电。呼叫停止后,进度对话框未显示,但如果对话框正在显示,则活动布局以这种方式变暗。你有什么想法吗?

我有这样的事情:

Recovery recovery=new Recovery();
recovery.execute();

和异步任务:

public class Recovery extends AsyncTask<String, Void, Integer>{
         @Override
         protected Integer doInBackground(String... uri) {
             publishProgress();
             //some code
             return Ret;
         }
         @Override
         protected void onProgressUpdate(Void... values) {
             super.onProgressUpdate(values);
             showDialog(RECOVERY);
         }
         @Override
         protected void onPostExecute(Integer result) {
             super.onPostExecute(result);
             dismissDialog(RECOVERY);
         }
    }
4

1 回答 1

0

使用这种方式它工作

  ProgressDialog dialog = new ProgressDialog(YourActivity.this);

  @Override
     protected void onPreExecute()
     {
        this.dialog.setMessage("Loading Please Wait...");
        this.dialog.show()
    }



     @Override
     protected void onPostExecute(Integer result) {
         super.onPostExecute(result);
         if (this.dialog.isShowing()) {
               this.dialog.dismiss(); 
             }
     }
于 2012-04-05T12:10:43.760 回答