Stranger B.
Stranger B.

Reputation: 9374

How to make a ProgressDialog uncanceled in Android

How to make the ProgressDialog uncanceled in android, when loading I don't want to have the ability to abort the ProgressDialog

        SingupBar = new ProgressDialog(this);
        SingupBar.setMessage("Chargement...");
        SingupBar.setIndeterminate(false);

        SingupBar.show();
        .......
        SingupBar.hide();

and is this the best way to use it ?

Upvotes: 2

Views: 157

Answers (4)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

@Yasser B.

You can and to prevent dismiss dialog box on outside touch use this

 SingupBar.setCanceledOnTouchOutside(false);

Finally,

SingupBar = new ProgressDialog(this);
SingupBar.setMessage("Chargement...");
SingupBar.setIndeterminate(false);
SingupBar.setCancelable(false);
SingupBar.setCanceledOnTouchOutside(false);

For more info you can visit

http://developer.android.com/reference/android/app/Dialog.html#setCancelable(boolean)

Upvotes: 2

Ibukun Muyide
Ibukun Muyide

Reputation: 1298

The setCancelable property does it

     ProgressDialog   progressDialog = new ProgressDialog(this);
     progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
     progressDialog.setMessage("Loading...please wait");
     progressDialog.setCancelable(false);
     progressDialog.show();

set it to false.

Upvotes: 0

Iamat8
Iamat8

Reputation: 3906

Create a custom dialog with progress bar in it use this....

Dialog d = new Dialog(getBaseContext());
d.setCancelable(false);

Upvotes: 1

N J
N J

Reputation: 27545

Use dialog.setCancelable(false);

    SingupBar = new ProgressDialog(this);
    SingupBar.setMessage("Chargement...");
    SingupBar.setIndeterminate(false);
    SingupBar.setCancelable(false);

Upvotes: 2

Related Questions