To display the prgress dialog, you can use the code below
ProgressDialog dialog = new ProgressDialog(MainActivity.this); dialog.setMessage("Your message.."); dialog.show();
before calling the async task, i.e. before new YourTask.execute().
and in the onPostExecute function for asynthesis. you can use
dialog.dismiss();
to close the dialog box.
source share