slider

还是菜鸟
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

progressdialog not display

Posted on 2013-04-03 15:22  slider  阅读(229)  评论(0编辑  收藏  举报
new AsyncTask<Void, Void, String>(){
            ProgressDialog progressDialog;
            protected void onPreExecute() {
                progressDialog = new ProgressDialog(EditSelectedActivity.this);
                progressDialog.setMessage(getResources().getString(R.string.d_loading));
                progressDialog.show();
            };
            @Override
            protected String doInBackground(Void... params) {
                
                return null;
            }
            protected void onPostExecute(String result) {
                
                if (progressDialog != null)
                    progressDialog.dismiss();
            }
            
        }.execute(null,null);

  i usually use 'view.post(Runnable r)' to post a time-consuming operation. but progressdialog does not work. i could see the progress dialog when the app runs. but i found using 'thread' or 'asyntask' work well.