title: dialog box with multiple checkboxes android souce code
body: <p>I have an android app with a button. When clicking the button I need on the screen a dialob box with multiple check boxes annd an ok button. How to do that? Do i need an xml layout for the list with checkboxes?</p>
  
  <p><strong>1. How to add to each element in the list dialog box a check box?</strong></p>
  
  <p><strong>2. How to put in a string all the checked elements when the button OK is pressed.</strong></p>
  
  <p>this is my code so far:</p>
  
  <pre><code> app_part.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
  
  
                  final String items[] = {"1","2","3","4"};
  
                  AlertDialog.Builder ab=new AlertDialog.Builder(ConferenceClass.this);
                  ab.setTitle("SIP CONTACTS");
                  ab.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface d, int choice) {
                      // on OK button action
                      }
                      });
                  ab.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface d, int choice) {
                      // on Cancel button action
                      }
                      });
                  ab.setItems(items, new DialogInterface.OnClickListener() {
  
  
                  public void onClick(DialogInterface d, int choice) {
  
  
                  }
                  });
                  ab.show();
                   //open contact list and select persons
  
  
                  }
          });
  </code></pre>