I have AlertDialog and there are some buttons. By clicking them, some function/method begin to work.
But what to do if user clicks outside of AlertDialog view?
I want to start specific function then user clicks at empty field (outside of dialog view)

You have to use this -
dialog.setCanceledOnTouchOutside(true);
Then for executing your function on outside click of dialog, do like this -
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
// dialog dismisses
// Do your function here
}
});
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