I have an AsyncTask that shows a progressDialog whilst working (it calls runOnUiThread from within doInBackground to show the progress dialog).
<
Its very simple just copy the below code and paste within Async task..
ProgressDialog dialog;
@Override
protected void onPreExecute() {
dialog = new ProgressDialog(MainActivity.this) {
@Override
public void onBackPressed() {
dialog.cancel();
dialog.dismiss();
}
};
// dialog.setTitle("file is..");//its optional If u want set title in progress
// bar
dialog.setMessage("Loading file....");
dialog.setCancelable(false);
dialog.show();
}