How to close AlertDialog with a mouse click?
I have an AlertDialog
with a short information about my application and I would like to close it without any buttons, just with a mouse click somewhere on my Alert开发者_开发知识库Dialog. Is it possible to do that?
You can use
mAlertDialog.setCanceledOnTouchOutside(true);
Using this if you click outside the dialog it will get dismissed.
Maintain the reference to AlertDialog and on mouse click, call mAlertDialog.dismiss() to dismiss the dialog.
精彩评论