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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -