I have this code to show a dialog with singlechoice(radio) options.
AlertDialog ad = new AlertDialog.Builder(this)
.setCancelable(false)
.setIcon(R.drawable.
1). create Array.
final ArrayList arrData = new ArrayList();
2). add data to array you have created.
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
arrData .add(cursor.getString(1));
// (1 = int columnIndex)
} while (cursor.moveToNext());
}
}
3). get data like this.
public void onClick(DialogInterface dialog, int item) {
Log.d("Selected", arrData.get(item) + "");
}
4). that's all :)