Hi,

Unfortunately moving the code to onPrepareDialog() also didn't help. I
create an instance and setup the button in onCreateDialog() and set
the error string in onPrepareDialog() but that doesn't seem to work. I
see that screen gets a little darker and something very small shows up
(I can't even see the button there).

protected Dialog onCreateDialog(int id) {
       AlertDialog alertDialog;

       switch (id) {
       case ERROR_DIALOG_ID:
               alertDialog = new AlertDialog.Builder(this).create();
               alertDialog.setButton("OK", new
DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int which) {
                           return;
                   }
               });
               return alertDialog;
       }
       return null;
   }

    protected void onPrepareDialog(int id, Dialog dialog) {
        switch (id) {
            case ERROR_DIALOG_ID:
                AlertDialog alertDialog = (AlertDialog)dialog;
                alertDialog.setMessage(alertString);
                //alertDialog.show();
                break;
        }
    }

Thanks,
Sarath

On Sun, Jan 4, 2009 at 5:38 PM, hazmatzak <mc.y...@gmail.com> wrote:
>
> Yes, dialogs are reused; that's part of the idea behind having the
> Activity manage the dialogs. Generally, onCreateDialog is called only
> once for a given ID (you can use the debugger to verify this).
> Override onPrepareDialog to modify the created/reused dialog just
> before it appears.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to