Posted on

ProgressDialog, ProgressBar

The simpliest way to show progress in ActionBar is

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.activity_main);


and then call

        setProgressBarIndeterminateVisibility(true);

to show progressbar

Use ProgressDialog

            ProgressDialog pd;
            pd = new ProgressDialog(this);
            pd.setMessage("downloading...");
            pd.setIndeterminate(true);
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pd.setCancelable(true);
            pd.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    // TODO if canceled (e.g. user pressed BackButton)
                }
            });
            pd.show();

Also

ProgressBar under ActionBar (pdf)

How to show progress (pdf)

SwipeRefreshLayout (pdf)

AsyncTaskManager (pdf, source)

Leave a Reply

Your email address will not be published. Required fields are marked *