Code example for ProgressDialog

Methods: setIndeterminatesetMessagesetProgressStyle, setCancelable, setCanceledOnTouchOutside

0
            mPostExecuteTask = postExecuteTask;
            // lazy initialization of progress dialog for loading attachments 
            if (mProgressDialog == null) {
                mProgressDialog = createProgressDialog();
            } 
            mProgressDialog.setMessage(mActivity.getText(dialogStringId));
        } 
 
        /** 
         * Initializes the progress dialog with its intended settings. 
         */ 
        private ProgressDialog createProgressDialog() {
            ProgressDialog dialog = new ProgressDialog(mActivity);
            dialog.setIndeterminate(true);
            dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            dialog.setCanceledOnTouchOutside(false);
            dialog.setCancelable(false);
            return dialog;
        } 
 
        /** 
         * Activates a progress spinner on the UI.  This assumes the UI has invoked this Task.