2

I have a problem of showing the progressDialog on android. It did shows up to the screen but it took few seconds before it really show the dialog.

This is the code i did to show the dialog

Handler saveHandler = new Handler() {

                @Override
                public void handleMessage(Message msg) {
                    GallerySaveActivity.this.Submit(progress);

                    Button btn_next = (Button) findViewById(R.id.btn_next);
                    btn_next.setEnabled(true); 
                }
            };
            progress.showDialog(saveHandler, "", "Accessing Facebook ...");
            Thread progress_thread = new Thread(progress); 
            progress_thread.start();

Do I have to do any extra work on the Thread object in order to show the dialog instantly without any delay.

LittleFunny
  • 8,155
  • 15
  • 87
  • 198
  • Why do you need an additional thread? ProgressDialog should run in UI thread... Can you post your progress dialog creation routine? – Pavel Dudka Jul 27 '12 at 23:54
  • http://stackoverflow.com/questions/2798443/android-progressdialog-doesnt-show I do that if operation is heavy. But it shouldn't delay to show the dialog. – LittleFunny Jul 28 '12 at 00:51

1 Answers1

1

Consider using an AsyncTask: show your dialog in onPreExecute(), and do your background tasks in doInBackground().

Anh3Saigon
  • 199
  • 5