I create AlertDialog, I set setOnCanceledOnTouchOutside and setCancelable params, but then I click outside dialog it hides. Maybe someone can help me?
dialog = new AlertDialog.Builder(getContext()).setView(table).setTitle(R.string.order_start_title)
.setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
onOrderStartCancel(context);
}
}).setPositiveButton(R.string.dialog_start_order, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
onOrderStart(context, goodsTypeId, goodType);
}
}).create();
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
dialog.show();
If you dont want to allow user to cancel dialog then
use
dialog.setCancelable(false);
^^^^^
instead of
dialog.setCancelable(true);
also remove this dialog.setCanceledOnTouchOutside(true); <---
if not needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With