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