Reputation: 127
Can you explain me why this Dialog won't display items?
new AlertDialog.Builder(MainActivity.context)
.setTitle("Gestione topic")
.setMessage("Cosa vuoi leggere?")
.setItems(R.array.topicChoices, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//code here
}
}).setNegativeButton("Annulla", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).show();
R.array.topicChoices
<string-array name="topicChoices">
<item>Topic non letti</item>
<item>Risposte non lette</item>
</string-array>
Where is the bug?
Thanks, guys.
Upvotes: 0
Views: 480
Reputation: 46
Refer here where the alert dialog items are not displayed due to the above reason.
Upvotes: 1
Reputation: 759
setMessage overrides setItem so you have to remove setMessage.
Upvotes: 7