I want to create an Dialog options menu on click of a listview item. Its working perfectly when using static string array for dialog options. But using dynamic values its showing only an item with comma separated.
Here is my code
StringBuilder builder = new StringBuilder();
String delimiter = "";
for(int i = 0; i< myarray.length;i++){
builder.append(delimiter);
builder.append(myarray[i]);
delimiter = ",";
}
String[] Options = new String[] { "Reply" ,builder.toString()};
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle("TEst");
dialog.setItems(Options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (id == 0) {
}
if (id == 1) {
}
}
});
dialog.show();
myarray
? – Candy Apr 24 at 7:58