Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my ProgressDialog exit when I click on Activity?

Tags:

android

I am showing a ProgressDialog using the following code:

void showProccess() {    
    p = new ProgressDialog(this);
    p.setTitle("PleaseWait");                   
    p.setMessage("data loading");
    p.show();
}

In Android 2.3.1 when a ProgressDialog is shown, I can't click on the Activity. But in Android 4.0.3, I click on Activity and the ProgressDialog will exit. I want the ProgressDialog to not exit, the same as Android 2.3.1. Can you help me? Thanks.

like image 722
mum Avatar asked Oct 09 '12 04:10

mum


1 Answers

You should set the following:

 p.setCancelable(false);

By this , progress dialog can not be cancelled.

like image 168
Yogesh Somani Avatar answered Sep 19 '22 01:09

Yogesh Somani