In some cases we need to wait until some long process is carried out in an activity. In this case its a good practice to notify user that the operation is in progress and also for preventing the UI from freezing. For this purpose android API has got classes such as ProgressDialog and ProgressBar. Here I am going to explain one of the method that is how to use ProgressDialog in an Activity.
The syntax for ProgressDialog is
- ProgressDialog.show(Context context, CharSequence title, CharSequence message);
Now we need to create thread for the complex operation. The entire code is shown below
private ProgressDialog progressDialog;
progressDialog=ProgressDialog.show(Classname.this, "Please Wait", "Executing complex operation....");
public void run()
//add ur complex function here