Hi I am making a simple app and I have an AlertDialog window. I was trying to add a checkbox to the AlertDialog (my try below). This is a checkbox that will ask the user not to display this message again. Is there a way to add a checkbox to my AlertDialog without adding another Layout?
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Delete Alert");
builder.setMessage("Voice mail will be permanently deleted! \n This message will not appear again!");
builder.setItems(deleted, null);
builder.setMultiChoiceItems(deleted, null, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
if (isChecked) {
} else {
}
}
});
builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
// Create the AlertDialog object and return it
AlertDialog alertDialog = builder.create();
alertDialog.show();
If someone could point me at some resources I'd appreciate it.
Aucun commentaire:
Enregistrer un commentaire