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?
1. How to add to each element in the list dialog box a check box?
2. How to put in a string all the checked elements when the button OK is pressed.
this is my code so far:
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
}
});