I recently discovered that some of the dialogs I implemented in my app work very well, except on samsung devices.
On every device I tested, the "setCancelable(true)" dismissed the dialog when clicking outside of it, except on a samsung devices.
The samsung devices I tested on are : Samsung Galaxy S3, S4 and Samsung Galaxy Tab 2.
new AlertDialog.Builder(context).setCancelable(true) is the exact code.
Anyone else out there that had this problem? Thank you!
Android AlertDialog can be used to display the dialog message with OK and Cancel buttons. It can be used to interrupt and ask the user about his/her choice to continue or discontinue. Android AlertDialog is composed of three regions: title, content area and action buttons.
setIcon() method is use to set the icon on Alert dialog box.
Creating a Custom Layout If you want a custom layout in a dialog, create a layout and add it to an AlertDialog by calling setView() on your AlertDialog. Builder object. By default, the custom layout fills the dialog window, but you can still use AlertDialog. Builder methods to add buttons and a title.
An alert dialog can have maximum three action buttons. If you want the user to accept the action, use Positive action button. It is normally displayed as OK/YES. If the user wants to cancel the action , then you can use Negative action button (NO).
I had the same problem, for any reason in some devices like Samsung S3 the dialog doesn't disappear doing click out side. You can fix it using setCanceledOnTouchOutside method:
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
AlertDialog dialog = b.create();
dialog.setCanceledOnTouchOutside(true);
dialog.show();
Something like that. I hope to help you.
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