How to get selected item of a singlechoice Alert Dialog?

Posted by Pentium10 on Stack Overflow See other posts from Stack Overflow or by Pentium10
Published on 2010-03-22T17:01:44Z Indexed on 2010/03/22 17:11 UTC
Read the original article Hit count: 495

I have this code to show a dialog with singlechoice(radio) options.

AlertDialog ad = new AlertDialog.Builder(this)
.setCancelable(false)
.setIcon(R.drawable.alert_dialog_icon)
.setTitle(R.string.choose_one)
.setSingleChoiceItems(seq, pos,null)
.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { 
  public void onClick( DialogInterface dialog, int whichButton) 
  { 
    // dialog dismissed
  } 
 }).create();

How do I get the choice that has been selected?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk