To do it, I did as follows, in my custom DialogPreference
@Override
protected void showDialog(Bundle state) { super.showDialog(state); final AlertDialog dialog = (AlertDialog) getDialog(); Button button = dialog.getButton(DialogInterface.BUTTON_POSITIVE); button.setOnClickListener(new View.OnClickListener() { @Overridepublic void onClick(View view) { // Validation if (mNameEditText.getText().toString().isEmpty()) { mNameEditText.setError(getContext().getString(R.string.pref_error_empty)); return; } PersonPreference.super.onClick(dialog, DialogInterface.BUTTON_POSITIVE); dialog.dismiss(); } } ); }