Android Progress Dialog Example

In android, we can show progress bar through dialog also. For this we need to use ProgressDialog.

Here is a example for how to use ProgressDialog : -

[sourcecode language="java"]
public class ExampleApp extends Activity {
protected void onCreate(Bundle savedInstanceState) {
ProgressDialog dialog =, "",
"Please wait for few seconds...", true);
To dismiss a ProgressDialog use ProgressDialogName.dismiss() ( ex :- dialog.dismiss()).
The output will looks like

Android Progress Dialog Style Example


Hey nycsdk, set this line in

Hey nycsdk,

set this line in onClick() to show progress dialog

ProgressDialog dialog =, "Heading","Please wait for few seconds...", true);

@nycsdk, you need to use

you need to use dialog.dismiss(); to close the progressdialog.

Hey nycsdk, I already

Hey nycsdk,

I already mentioned the answer in my previous comment.

@nycsdk, Try using thread and


Try using thread and check whether the mediaplayer started playing or not in background using isPlaying() in meida player.





// Stop the thread here after dismissing the dialog.


@nycsdk, You need to create


You need to create a thread. Thread will run in background process.
In thread you need to check whether the mPlaer is playing or not.
using that mPlayer.isPlaying() you need to control your dialog.