Is it possible to programmatically close an alert dialog
Hi,
I would like to programmatically close an alert dialog. Is it possible?
The problem I'm trying to solve is the following: when the device loses the internet connection, I pop up a 'Connection lost' alert. When the connection is found, I pop up a 'Connection found' alert. I would like to address the rare occurrences when the connection is lost and found before the user has had time to close the 'Connection Lost' dialog.
I tried to just update the title and message of the currently displayed alert, but it didn't refresh.
I haven't found how to close the first dialog programmatically (attempted 'hide' and 'close' although it's not in the API documentation and it didn't work).
Does anyone have other suggestions?
Thanks in advance,
Laure
3 Answers
-
Why don't you make your own "alert" ?
You can find easily some photoshop iPhone UI elements to emulate the native alert look. -
This would be a good feature to add. I'll add it to the list
-
Try the following to use the native platform's Alert box:
ohCrud = Ti.UI.createAlertDialog({ title:'Houston: We have a problem!', message:'Unfortunately, things are now foobar.' }); ohCrud.show(); // Show debugRez for 4 seconds, as example var handleCrud = setTimeout(function(){ ohCrud.hide(); // Or add more code to investigate the issue, etc }, 4000);
The cool thing is that you could technically put this as a function, calling it on an Event: using the
var handleCrud
to suss things out.HTH
//Jesse