Close dialog if already showing


I have this dialog window:
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.


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.


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


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