title: How to save state and check default of radio button in alert dialog box(android)?
body: <p>I'm using alert dialog box so that the user can select one of the option from the list in android. Now the problem i'm facing is that i don't know how to check a default radio button in the starting and even after user selects any of the option from the radio button I don't know how to save the state of radio button. I'm using this code:</p>
  
  <pre><code>private void SingleChoiceWithRadioButton() { 
           final String[] selectFruit= new String[]{"Blacklist","Whitelist"};
           Builder builder = new AlertDialog.Builder(this);  
           builder.setTitle("Single Choice With Radio button");  
           builder.setSingleChoiceItems(selectFruit, -1,  
               new DialogInterface.OnClickListener() {  
                 @Override  
                 public void onClick(DialogInterface dialog, int which) { 
  
                   Toast.makeText(callBlockerSettings.this, selectFruit[which]+":"+ which + " Selected", Toast.LENGTH_LONG).show();  
                 //  dialog.dismiss();  
                 }  
               });  
           builder.setPositiveButton("ok",  
               new DialogInterface.OnClickListener() {  
                 @Override  
                 public void onClick(DialogInterface dialog, int which) {  
                   dialog.dismiss();  
                 }  
               });  
           AlertDialog alert = builder.create();  
           alert.show();  
         } 
  </code></pre>