I’ve built an AlertDialog using a cursor to populate the list items in the dialog. All works well with creating the list.
I even get the ‘which’ item back in the callback for the row selected. One problem remains…
How do I get the text back for the item that was clicked???
I don’t want to requery the cursor and spin through the results getting to the ‘which’ item but I don’t know how else to get the value.
Thanks
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_GENUS_LIST_CURSOR:
Cursor cursor = managedQuery(AquaNotesDbContract.Genus.CONTENT_URI,
GenusQuery.PROJECTION, null, null, null);
return new AlertDialog.Builder(Gallery.this)
.setTitle(Res.string.select_genus)
.setCursor(cursor,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
/* an item was selected */
< this is where I want to learn the text selected??? >
}
},
GenusQuery.PROJECTION[GenusQuery.COMMON_NAME])
.create();
}
return null;
}
How about in the onClick handler…