ProgressDialog show - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ProgressDialog show method.

This code example shows how to use the following methods:show
	public static void runWithMessage(final Activity activity, String key, final Runnable action, final Runnable postAction, final boolean minPriority) {
		final String message =
			ZLResource.resource("dialog").getResource("waitMessage").getResource(key).getValue();
		activity.runOnUiThread(new Runnable() {
			public void run() { 
				final ProgressDialog progress = ProgressDialog.show(activity, null, message, true, false);
 
				final Thread runner = new Thread() {
					public void run() { 
						action.run();
						activity.runOnUiThread(new Runnable() {
							public void run() { 
								try { 
									progress.dismiss();
								} catch (Exception e) {
									e.printStackTrace();
								} 
								if (postAction != null) {
									postAction.run();
								} 
7
CodeRank
This code example shows how to use the following methods:setTitle, setIndeterminate
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Bundle args = getArguments();
        String title = args.getString(ARG_TITLE);
 
        ProgressDialog dialog = new ProgressDialog(getActivity());
        dialog.setIndeterminate(true);
        dialog.setTitle(title);
 
        return dialog;
    } 
} 
8
CodeRank
This code example shows how to use the following methods:dismiss, getOwnerActivity
This code example shows how to use the following methods:requestWindowFeature, setMessage
    } 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mSpinner = new ProgressDialog(getContext());
        mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
        mSpinner.setMessage("Loading...");
 
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        mContent = new RelativeLayout(getContext());
 
        setUpWebView(); 
 
        // setUpCloseBtn(); 
 
        addContentView(mContent, new LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT));
    } 
 
8
CodeRank
This code example shows how to use the following methods:isShowing, show, setMessage
 
	@Override 
	protected void onProgressUpdate(String... values) {
		super.onProgressUpdate(values);
		if (values != null && values.length > 0) {
			dialog.setMessage(values[0]);
		} 
		if (!dialog.isShowing()) {
			dialog.show();
		} 
	} 
 
	@Override 
	protected void onPostExecute(Boolean success) {
		super.onPostExecute(success);
		dialog.dismiss();
		if (callback != null) {
			callback.execute();
		} 
	} 
7
CodeRank
This code example shows how to use the following methods:isShowing, setMax, setProgress
    public synchronized boolean isShowing() { 
        return dialog != null && dialog.isShowing();
    } 
 
    public synchronized void setMaxProgressAndReset(final int max) {
        if (dialog != null && dialog.isShowing()) {
            final int modMax = max / this.progressDivider;
            dialog.setMax(modMax);
            dialog.setProgress(0);
        } 
        this.progress = 0;
    } 
 
    public synchronized void setProgress(final int progress) {
        final int modProgress = progress / this.progressDivider;
        if (dialog != null && dialog.isShowing()) {
            dialog.setProgress(modProgress);
        } 
        this.progress = modProgress;
    } 
8
CodeRank
This code example shows how to use the following methods:setOnCancelListener, show, setMessage
		dialog.dismiss();
	} 
 
	@Override 
	protected void onPreExecute() { 
		dialog = new ProgressDialog(context);
		dialog.setMessage("Removing Feed");
		dialog.setOnCancelListener(new OnCancelListener() {
 
			@Override 
			public void onCancel(DialogInterface dialog) {
				cancel(true);
 
			} 
 
		}); 
		dialog.show();
	} 
 
	@SuppressLint("NewApi") 

8
CodeRank
This code example shows how to use the following methods:isShowing, show, setMessage
 
	@Override 
	protected void onProgressUpdate(String... values) {
		super.onProgressUpdate(values);
		if (values != null && values.length > 0) {
			dialog.setMessage(values[0]);
		} 
		if (!dialog.isShowing()) {
			dialog.show();
		} 
	} 
 
	@Override 
	protected void onPostExecute(Boolean success) {
		super.onPostExecute(success);
		dialog.dismiss();
		if (callback != null) {
			callback.execute();
		} 
	} 
7
CodeRank
This code example shows how to use the following methods:setCancelable, setOnCancelListener, setIndeterminate
		return mAsyncTask != null;
	} 
	 
	private void setupProgressDialog(Context context, OnTaskCompleteListener taskCompleteListener) {
		// Setup progress dialog 
		mProgressDialog = new ProgressDialog(context);
		mProgressDialog.setIndeterminate(true);
		mProgressDialog.setCancelable(true);
		mProgressDialog.setOnCancelListener(this);
	} 
} 
6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setMessage
 
		@Override 
		protected void onCreate(Bundle savedInstanceState)
			{ 
				super.onCreate(savedInstanceState);
				mSpinner = new ProgressDialog(getContext());
				mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
				mSpinner.setMessage("Loading...");
 
				mContent = new LinearLayout(getContext());
				mContent.setOrientation(LinearLayout.VERTICAL);
				setUpTitle(); 
				setUpWebView(); 
				Display display = getWindow().getWindowManager().getDefaultDisplay();
				final float scale = getContext().getResources().getDisplayMetrics().density;
				float[] dimensions = (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
				addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f)));
			} 
 
		private void setUpTitle() 
7
CodeRank
This code example shows how to use the following methods:cancel, setMax, setMessage, setProgress
 
	@Override 
	public void handleMessage(Message msg) {
		int max = msg.getData().getInt("max");
		if (max > 0)
			progressDialog.setMax(max);
		int progress = msg.getData().getInt("progress");
		boolean progress_sent = msg.getData().getBoolean("progress_sent");
		if (progress_sent)
			progressDialog.setProgress(progress);
 
		String message = msg.getData().getString("message");
		if (message != null)
			progressDialog.setMessage(message);
 
		if (msg.getData().getBoolean("finished")) {
			progressDialog.cancel();
		} 
 
	} 

6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setMessage
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        mSpinner = new ProgressDialog(getContext());
         
        mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
        mSpinner.setMessage("Loading...");
 
        mContent = new LinearLayout(getContext());
         
        mContent.setOrientation(LinearLayout.VERTICAL);
         
        setUpTitle(); 
        setUpWebView(); 
         
        Display display = getWindow().getWindowManager().getDefaultDisplay();
        double[] dimensions = new double[2];
         
7
CodeRank
This code example shows how to use the following methods:dismiss, isShowing, getMax, getProgress, incrementProgressBy
	/** 
	 * If the dialog is still showing, completes the progress bar in this dialog and dismisses it. 
	 * @param dialog 
	 */ 
	public static void finishProgressDialog(ProgressDialog dialog) {
		if(dialog.isShowing()) {
			int diff = dialog.getMax() - dialog.getProgress();
			dialog.incrementProgressBy(diff);
			dialog.dismiss();
		} 
	} 
	 
	/** 
	 * Calculates and returns the remaining progress for this progress dialog. 
	 * @param dialog 
	 * @return 
	 */ 
	public static int getRemainingProgress(ProgressDialog dialog) {
		if(null == dialog) {
			return 0; 
6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setOnKeyListener, setMessage
	} 
 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mSpinner = new ProgressDialog(getContext());
		mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
		mSpinner.setMessage("Loading...");
		mSpinner.setOnKeyListener(new OnKeyListener() {
 
			@Override 
			public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
				onBack(); 
				return false; 
			} 
 
		}); 
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.getWindow().setFeatureDrawableAlpha(Window.FEATURE_OPTIONS_PANEL, 0);  
		mContent = new RelativeLayout(getContext());
6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setMessage
This code example shows how to use the following methods:setCancelable, setOnCancelListener, setIndeterminate
 
    public AsyncTaskManager(Context context, IOnTaskCompleteListener taskCompleteListener) {
	// Save reference to complete listener (activity) 
	mTaskCompleteListener = taskCompleteListener;
	// Setup progress dialog 
	mProgressDialog = new ProgressDialog(context);
	mProgressDialog.setIndeterminate(true);
	mProgressDialog.setCancelable(true);
	mProgressDialog.setOnCancelListener(this);
    } 
 
    public void setupTask(TaskBase<?,?> asyncTask) {
	// Keep task 
	mAsyncTask = asyncTask;
	// Wire task to tracker (this) 
	mAsyncTask.setProgressTracker(this);
	// Start task 
	mAsyncTask.executeNonGenericWay();
    } 
 
6
CodeRank
This code example shows how to use the following methods:dismiss, getProgress, incrementProgressBy
			{ 
				super.handleMessage(msg);
				switch(msg.what)
				{ 
				case INCREASE:
					pd.incrementProgressBy(1);
					if(pd.getProgress()>=100)
						pd.dismiss();
				} 
			} 
		}; 
		 
	} 
	public Dialog onCreateDialog(int id)
	{ 
		 
		switch(id)
		{ 
		case PROGRESS_DIALOG:
			pd=new  ProgressDialog(this);
6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setOnKeyListener, setMessage
	} 
 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mSpinner = new ProgressDialog(getContext());
		mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
		mSpinner.setMessage("Loading...");
		mSpinner.setOnKeyListener(new OnKeyListener() {
 
			@Override 
			public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
				onBack(); 
				return false; 
			} 
 
		}); 
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.getWindow().setFeatureDrawableAlpha(Window.FEATURE_OPTIONS_PANEL, 0);  
		mContent = new RelativeLayout(getContext());
6
CodeRank
This code example shows how to use the following methods:requestWindowFeature, setMessage
This code example shows how to use the following methods:requestWindowFeature, setOnCancelListener, setMessage
      .setPositiveButton(android.R.string.ok, listener)
      .create();
  } 
 
  public static ProgressDialog createSpinner(final Context context, final CharSequence text, final OnCancelListener oncancel) {
    final ProgressDialog spinner = new ProgressDialog(context);
    spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    spinner.setMessage(text);
    spinner.setOnCancelListener(oncancel);
    return spinner;
  } 
 
  /** 
   * Converts device independent points to actual pixels. 
   * @param displayMetrics display metrics 
   * @param dip dip value 
   * @return pixels count 
   */ 
  public static int pixelsWidth(final DisplayMetrics displayMetrics, final int dip) {
    final float scale = displayMetrics.density;
6
CodeRank
This code example shows how to use the following methods:dismiss, getMax, setMessage, setProgress
			} 
			break; 
		case GeoQuestProgressHandler.MSG_FINISHED:
			if (isLastInChain) {
				if (progressDialog != null) {
					progressDialog.setProgress(progressDialog.getMax());
					progressDialog.setMessage("");
					progressDialog.dismiss();
				} else if (progressBar != null) {
					progressBar.setProgress(progressBar.getMax());
					if (update != null) {
						update.setText("");
					} 
				} 
			} 
			break; 
		case GeoQuestProgressHandler.MSG_ABORT_BY_ERROR:
			if (isLastInChain) {
				if (progressDialog != null) {
					progressDialog.setProgress(0);
6
CodeRank
This code example shows how to use the following methods:show, getMax, setMax
        this.mProgressDialog.setMax(value);
    } 
 
    @Override 
    public void showLoading(String message) {
        int maxValue = this.mProgressDialog.getMax();
        this.mProgressDialog.setMax(Math.max(maxValue, 0));
 
        this.mProgressDialog.show();
 
        AppearanceUtils.showToastMessage(this.mContext, message);
    } 
 
    @Override 
    public void hideLoading() { 
        this.mProgressDialog.dismiss();
    } 
 
    @Override 
    public void showSuccess(File file) {
6
CodeRank
This code example shows how to use the following methods:setOnCancelListener, setOnDismissListener
    public AsyncDialog(Context context) {
        this(context, "Processign...");
    } 
    public AsyncDialog(Context context, String msg) {
        this.msg = msg;
        dialog = new ProgressDialog(context);
        dialog.setOnCancelListener(this);
        dialog.setOnDismissListener(this);
        execute();
    } 
 
    @Override 
    public void onCancel(DialogInterface dialog) {
        dialog.dismiss();
        cancel(true);
    } 
 
    @Override 
    public void onDismiss(DialogInterface dialog) {
        dialog.dismiss();
6
CodeRank
This code example shows how to use the following methods:cancel
		dialog.show();
 
		new Thread(new Runnable() {
			@Override 
			public void run() { 
				runnable.setProgressDialog(dialog);
				runnable.run(dialog);
				dialog.cancel();
			} 
		}).start();
		return dialog;
	} 
 
	public static String questionDialog(Activity activity, int titleResource, int messageResource, int okResource,
			String input, boolean cancelable, int drawableResource, boolean password) {
		return questionDialog(activity, activity.getString(titleResource), activity.getString(messageResource),
				activity.getString(okResource), input, cancelable, drawableResource, password);
	} 
 
	public static String questionDialog(final Activity activity, final CharSequence title, final CharSequence message,
5
CodeRank
This code example shows how to use the following methods:cancel
        dialog.show();
 
        new Thread(new Runnable() {
            @Override 
            public void run() { 
                runnable.setProgressDialog(dialog);
                runnable.run(dialog);
                dialog.cancel();
            } 
        }).start();
        return dialog;
    } 
 
    public static String questionDialog(Activity activity, int titleResource, int messageResource,
            int okResource, String input, boolean cancelable, int drawableResource, boolean password) {
        return questionDialog(activity, activity.getString(titleResource),
                activity.getString(messageResource), activity.getString(okResource), input,
                cancelable, drawableResource, password);
    } 
 
5
CodeRank
This code example shows how to use the following methods:setTitle, setIndeterminate, setMessage
	} 
 
	@Override 
	protected void setupDialog() { 
		if (callingActivity != null){ 
			dialog = new ProgressDialog(callingActivity);
			dialog.setTitle("Initial Setup"); 
			dialog.setMessage("Please Wait..."); 
			dialog.setIndeterminate(true); 
		} 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:setTitle, setIndeterminate, setMessage
	} 
 
	@Override 
	protected void setupDialog() { 
		if (callingActivity != null){ 
			dialog = new ProgressDialog(callingActivity); 
			dialog.setTitle("Downloading Raw Picture"); 
			dialog.setMessage("Please Wait..."); 
			dialog.setIndeterminate(true); 
		} 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getWindow, setCancelable, setMessage
 
    @Override 
    protected Dialog onCreateDialog(int id) {
        switch (id) {
            case DIALOG_LOADING: {
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.setMessage("Loading ...");
                // dialog.setIndeterminate(true); 
                dialog.setCancelable(false);
                dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                        WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
                return dialog;
            } 
            default: 
                return super.onCreateDialog(id);
        } 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:setTitle, setProgress
		return jsonArray;
	} 
 
	@Override 
	protected void onProgressUpdate(Integer... progress) {
		dialog.setProgress(progress[0]);
		if (progress[0] == progressMax){
			dialogTitle = SERVER_TITLE;
			dialog.setTitle(dialogTitle);
		} 
	} 
 
	@Override 
	protected void onPostExectueOverride(AddUsersToGroupTask.ReturnFromAddUsersToGroupTask result) {
 
		if (applicationCtx == null) 
			return; 
 
		// no edits 
		if (getTotalEdits() == 0 && result.getErrorCode() == ReturnFromAddUsersToGroupTask.UNKNOWN_ERROR_CODE){
4
CodeRank

Related ProgressDialog show Questions & Answers: