在sdk中如何使用radio buttons解除AlertDialog?

我创建了一个alertdialog,里面有俩个radio buttons,当用户选择一个选项时,我需要解除alertdialog,但是不知道怎么解除,请大家的帮忙。

 final CharSequence[] items = {"First Option", "Second Option"};

 AlertDialog.Builder builder = new AlertDialog.Builder(context);
 builder.setTitle("Choose an option"); 
 builder.setSingleChoiceItems(items, -1, new  DialogInterface.OnClickListener() { 
       public void  onClick(DialogInterface dialog, int item) {
            Toast.makeText(getApplicationContext(), items[item],  Toast.LENGTH_SHORT).show(); 
       } 
 });
 final AlertDialog alert = builder.create();
 alert.show();

使用下面的代码:

final CharSequence[] items = {"First Option", "Second Option"};

 AlertDialog.Builder builder = new AlertDialog.Builder(context);
 builder.setTitle("Choose an option"); 
 builder.setSingleChoiceItems(items, -1, new  DialogInterface.OnClickListener() { 
   public void  onClick(DialogInterface dialog, int item) {
        dialog.dismiss();
        Toast.makeText(getApplicationContext(), items[item],  Toast.LENGTH_SHORT).show(); 
   } 
});
final AlertDialog alert = builder.create();
alert.show();
public void  onClick(DialogInterface dialog, int item) {
               Toast.makeText(getApplicationContext(), items[item],  Toast.LENGTH_SHORT).show();
               if("Second Option"==items[item]){
               System.out.println("here it is!");
               dialog.cancel();
               //cancelDLG();
               }                   
          } 

这样就是点了第二个就取消掉了
另外,你也可以定义个函数啊例如上面的cancelDLG
将这个提成全局的AlertDialog alert;
public void cancelDLG(){
alert.cancel();
}
这也一样取消掉