Code example for ProgressDialog

Methods: setIndeterminatesetProgressStyle, setCancelable, setCanceledOnTouchOutside

0
 
        /** 
         * 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. 
         */ 
        @Override 
        protected void onPreExecute() { 
            // activate spinner after half a second 
            mHandler.postDelayed(mShowProgressDialogRunnable, 500);
        }