showDialog() fails to show anything

by Greg Donald » Tue, 27 Oct 2009 10:50:30 GMT


Sponsored Links
 I'm having problems getting showDialog() to show anything.

I have this for my onCreateDialog() callback:

private static final int ID_DIALOG_X = 1;

protected Dialog onCreateDialog(int id) {
  if (id == ID_DIALOG_X) {
    ProgressDialog pg = new ProgressDialog(this);
      pg.setMessage("Loading..");
      return pg;
  }
  return super.onCreateDialog(id);
}

And then I'm calling it like this:

showDialog(ID_DIALOG_X);

But nothing shows up, no errors either.

Using ddms and Log.i() I can see my onCreateDialog() is being
executed, the new progress dialog gets created, but then nothing shows
up.

Any ideas?  TIA.


-- 
Greg Donald
 http://destiney.com/ 

--~--~---------~--~----~------------~-------~--~----~



showDialog() fails to show anything

by Greg Donald » Wed, 28 Oct 2009 16:44:42 GMT


 I'm having problems getting showDialog() to show anything.

I have this for my onCreateDialog() callback:

private static final int ID_DIALOG_X = 1;

protected Dialog onCreateDialog(int id) {
 if (id == ID_DIALOG_X) {
   ProgressDialog pg = new ProgressDialog(this);
     pg.setMessage("Loading..");
     return pg;
 }
 return super.onCreateDialog(id);
}

And then I'm calling it like this:

showDialog(ID_DIALOG_X);

But nothing shows up, no errors either.

Using ddms and Log.i() I can see my onCreateDialog() is being
executed, the new progress dialog gets created, but then nothing shows
up.

Any ideas?  TIA.


-- 
Greg Donald
 http://destiney.com/ 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


showDialog() fails to show anything

by Greg Donald » Wed, 28 Oct 2009 21:28:28 GMT


 



Anyone?



-- 
Greg Donald
 http://destiney.com/ 

--~--~---------~--~----~------------~-------~--~----~



showDialog() fails to show anything

by qlimax » Wed, 28 Oct 2009 22:15:44 GMT


 have you tried

Dialog pg=new ProgressDialog(this)

then return pg ?

just to try it... and UP this thread...:)





--~--~---------~--~----~------------~-------~--~----~



showDialog() fails to show anything

by Greg Donald » Wed, 28 Oct 2009 22:21:05 GMT


 



Tried it:

        protected Dialog onCreateDialog(int id) {
                if (id == ID_DIALOG_X) {
                        Dialog pg = new ProgressDialog(this);
                        return pg;
                }
                
                return super.onCreateDialog(id);
        }


Didn't help.


-- 
Greg Donald
 http://destiney.com/ 

--~--~---------~--~----~------------~-------~--~----~



showDialog() fails to show anything

by Lance Nanek » Thu, 29 Oct 2009 01:56:44 GMT


 This seems to show the dialog fine in some quick tests:
public class TestProgressDialog extends Activity {

        private static final int ID_DIALOG_X = 1;

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                showDialog(ID_DIALOG_X);
        }

        @Override
        protected Dialog onCreateDialog(int id) {
                if (id == ID_DIALOG_X) {
                        ProgressDialog pg = new ProgressDialog(this);
                        pg.setMessage("Loading..");
                        return pg;
                }
                return super.onCreateDialog(id);
        }

}

Are you calling showDialog from a different thread, maybe? What
version of Android are you using?



--~--~---------~--~----~------------~-------~--~----~



showDialog() fails to show anything

by Greg Donald » Thu, 29 Oct 2009 14:42:51 GMT


 


Nope, same thread.  I did experiment with runOnUiThread() for a while,
didn't seem to help.


I am using the 1.6 SDK.  I've tried building for both 1.5 and 1.6,
same result, it never shows up.



-- 
Greg Donald
 http://destiney.com/ 

--~--~---------~--~----~------------~-------~--~----~