views:

83

answers:

1

I want to display a progress bar/wheel, when doing some process, for instance, on a button click I want the screen to freeze and show a progress wheel , till the pressed action for example saving data in database is completed.

Is it possible, please provide code if applicable.

+1  A: 

In your OnClick(), I think you must use something like this :

 progressDialog = ProgressDialog.show(MyActivity.this,
                    "title","loading..." , true); 


            final Runnable runInUIThread = new Runnable() {
                public void run() {
                              //do some work
                    }
            };

             new Thread() {
                 @Override
                 public void run() {

                        handler.post(runInUIThread);
                    progressDialog.dismiss();

                    }
                }.start();
Nanis