Close dialog if already showing


#1

I have this dialog window:
dialogs.alert({
message: “No Internet connection!”,
okButtonText: “Ok”
});

Is there a way I can close this dialog, if already showing?
In native Android, you can have a dialog instance without showing it; that gives you the chance to check if the dialog is already showing before showing it again. This way you can avoid having multiple dialog windows on top o each other.


#2

You may listen to the promise returned by alert function, which is triggered only when alert is closed. So if the promise is still not fulfilled, then you have a active dialog and you can prevent showing another one.


#3

Hi @manojdcoder, what if the dialog has not been closed and another alert is triggered?


#4

As I already mentioned, check if the promise was fulfilled, if not then the dialog is not closed.