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/ 

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



Other Threads

1. App Widget with AlarmManager... full example source?

Hi all,

    I've created a simple app widget for personal use that queries a
site from the internet, parses the XML received and displays some info
from it.  I'm using a Droid X, if that makes a difference; both in the
emulator and as physical hardware, developing in the Android version
of the MotoDev IDE.

    No matter what I put in updatePeriodMillis, the shortest refresh
time I can get is 30 minutes (I thought this was a 1.6 only bug but
apparently not since I'm running 2.1) and I want it to refresh every 5
minutes, with some caveats.  I don't want the widget to refresh when
the screen is off and I want it to refresh immediately upon waking up
the screen.  My search for information says to set updatePeriodMillis
to 0 and use the AlarmManager instead, but I can't find any complete
code examples on just how to do this.

    Obviously, I'm new to Android development, and Java in general
actually, but I've been a developer for a very long time with
experience in just about every other language.  Currently working in
C#, so I thought I'd be able to jump in fairly easily.  Can anyone
point me to sample code or an open source project that does what I'm
looking for?  I have other questions, but until I get this piece
working they don't really matter.  :)

Ricoware

-- 

2. Fetch recurrent events

Hi
I was wondering how does one fetch recurring events from native
calendar?

-- 

3. (WTA & WTS) root LG Optimus GT 540

4. How can I delete the black shadow above framelayout in the tabwidget

5. Exchange 2010

6. How to send email with pictures attachment

7. XML schema for http://schemas.android.com/apk/res/android namespace