Ok i solved it myself.

I use setMessage together with setItems.. this does not work
One should use setTitle in stead of setMessage.

I think the builder show throw an exception if somebody uses
a illegal combination of parts (in my case: message + items)

Anyway its a small issue, but a nasty bug if you dont see it :-)

On 31 mei, 14:35, TjerkW <tje...@gmail.com> wrote:
> I have a game activity in which i have a dialog which is created in
> the onCreateDialog method of the activity:
>
>         case VICTORY_DIALOG:
>
>                                 String[] items={"Next Level", "Play Again", 
> "Exit"};
>
>                                 AlertDialog.Builder builder = new 
> AlertDialog.Builder(this);
>                                 builder.setMessage("You won!")
>                                 .setCancelable(false)
>                                 .setItems(items, new 
> DialogInterface.OnClickListener() {
>                                         public void onClick(DialogInterface 
> dialog, int id) {
>                                                 if(id==0) {
>                                                         
> SpaceWarsActivity.this.nextLevel();
>                                                 } else if(id==1) {
>                                                         
> SpaceWarsActivity.this.loadGame();
>                                                 } else if(id==2) {
>                                                         
> SpaceWarsActivity.this.onFinishGame();
>                                                 }
>                                         }
>                                 });
>                                 dialog=builder.create();
>                                 break;
>
> When the game ends i open this dialog from the game thread (not the ui
> thread) with the following code:
>
>                                                 activity.runOnUiThread(new 
> Runnable() {
>                                                         public void run() {
>                                                                 
> activity.showDialog(VICTORY_DIALOG);
>                                                         }
>                                                 });
>
> However... the dialog is just a small empty rectangle. No title, no
> items, nothing!
> The buttons (setPositiveButton,setNegativeButton,setNeutralButton) are
> working though.
>
> Wat am i doing wrong?
>
> Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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