As far as I know using AlertDialog.Builder
only to put up to 3 buttons ...
button "POSITIVE" (setPositiveButton), neutral button (setNeutralButton), and "NEGATIVE" (setNegativeButton), but if you want more things like a CheckBox or a progress bar use the object Dialog
Example of a custom dialog:
public void showDialog() {
final Dialog dialog = new Dialog(MainActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(androidialog.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.layout_dialog); // seu layout
dialog.setCancelable(false);
Button cancelar = (Button) dialog.findViewById(R.idialog.cancelar);
Button ok = (Button) dialog.findViewById(R.idialog.ok);
cancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss(); // fecha o dialog
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss(); // fecha o dialog
}
});
dialog.show();
}