The simpliest way to show progress in ActionBar is
[code language=”java”]
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
[/code]
and then call
[code language=”java”]
setProgressBarIndeterminateVisibility(true);
[/code]
to show progressbar
Use ProgressDialog
[code language=”java”]
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();
[/code]
Also