AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.settings);
// Specify the list array, the items to be selected by default (null for none),
// and the listener through which to receive callbacks when items are selected
builder.setMultiChoiceItems(R.array.settings_array, mEnables,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
mEnables[which] = isChecked;
}
});
// Set the action buttons
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
mOk = true;
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
return builder.create();