I've a problem with my DialogFragment
public class HorairesFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater i = getActivity().getLayoutInflater();
mView = i.inflate(R.layout.intervention_horaires_fragment, null);
AlertDialog.Builder b= new AlertDialog.Builder(getActivity())
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
AlertDialog alert = new AlertDialog.Builder(getFragmentManager())
.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
}).create();
alert.setMessage(message);
alert.setCancelable(false);
alert.show();
}
}
)
.setNegativeButton(R.string.annuler,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
}
);
b.setView(mView);
return b.create();
}
}
I removed the code for the readability. below is a screenshot of my DialogFragment
Sometimes the user enter some incorrect data, so when I click on the OK button, I need to show an AlertDialog with a custom error message (or a Toast maybe).
The problem follows : when he clicks on OK OK in the AlertDialog, it dismiss also my dialog
Is it possible to correct that behaviour ?