menu - Android: create a popup that has multiple selection options -


i've been searching around trying figure out how create popup or dialog has 4 options choose from.

i see picture on android developer site:

enter image description here

does know how code 1 on right? don't need icons next text, need able select 4 options.

you can create charsequence array options want show there , pass array alertdialog.builder method setitems(charsequence[], dialoginterface.onclicklistener).

an example:

charsequence colors[] = new charsequence[] {"red", "green", "blue", "black"};  alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("pick color"); builder.setitems(colors, new dialoginterface.onclicklistener() {     @override     public void onclick(dialoginterface dialog, int which) {         // user clicked on colors[which]     } }); builder.show(); 

the output (on android 4.0.3):

output

(background map not included. ;))


Comments