Same problem for me in a FragmentDialog. Here's my criminal/elegant solution:
Remove all buttons from the dialog (positive,negative,neutral). Add your buttons from the xml.eg.:
And then in your code handle it with:
view.findViewById(R.id.button_ok).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view2) {
if (wannaClose)
dismiss();
else
//do stuff without closing!
}
});
where view is the view assigned to the dialog!