//创建对话框 private void showLoadProgress(){ mProgressDialog = new ProgressDialog(this); mProgressDialog.setCancelable(false); mProgressDialog.setCanceledOnTouchOutside(false); mProgressDialog.setTitle("Scan Application"); mProgressDialog.setMessage("Loading ..."); mProgressDialog.show(); } private void queryEmailApplication(final Intent intent){ new AsyncTask<Void, Void, Boolean>() { @Override protected void onPreExecute() { //展示对话框 showLoadProgress(); } @Override protected Boolean doInBackground(Void... voids) { return checkAppList(intent); } @Override protected void onPostExecute(Boolean hasApp) { if (hasApp) { intent.setClass(WorkFlowSettingActivity.this, EmailConfigActivity.class); startActivity(intent); //执行异步任务,结束对话框 mProgressDialog.dismiss(); } else { //do nothing } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
展示dialog的,结束任务后,自动消失
最新推荐文章于 2021-05-26 08:21:55 发布