android - AlertDialog: Why can't I show Message and List together? -


does know why alertdialog doesn't show list of items when add message .setmessage()? negative , positive buttons shown, not list. when delete line .setmessage() works.

this code:

alertdialog.builder myalertdialog = new alertdialog.builder(this.getactivity()); myalertdialog.settitle("options"); myalertdialog.setmessage("choose color.");  charsequence[] items = {"red", "blue", "green" };  myalertdialog.setsinglechoiceitems(items, -1, new dialoginterface.onclicklistener() {      @override     public void onclick(dialoginterface dialog, int which) {         // stuff     } });  myalertdialog.setnegativebutton("no",new dialoginterface.onclicklistener() {      @override     public void onclick(dialoginterface dialog, int which) {        // stuff     } });  myalertdialog.setpositivebutton("yes",new dialoginterface.onclicklistener() {      @override     public void onclick(dialoginterface dialog, int which) {        // stuff     } });  myalertdialog.create(); myalertdialog.show(); 

from docs,

because list appears in dialog's content area, dialog cannot show both message , list , should set title dialog settitle().

the setmessage() , setsinglechoiceitems() therefore mutually exclusive.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -