I am writing a mobile app which connects through HTTP to upload some data to a server. I thought it would be user-friendly to show a progress bar while the phone uploads the information, so that the user knows it is still working. An indefinite progress bar should do it, I want to keep the things simple.
The first point where I need this alert is where the phone tries to determine the GPS coordinate of the user. This is a step where the phone might need 5 seconds or 3 minutes to finish the task. This is why I want to show the progress bar and force the user to wait (or quit the app).
Making alerts is simple, I tried myself and managed it to show it on the screen. BUT: it disappears after a few seconds, before the GPS coordinates are determined. How can I show and dispose the alert whenever I want (or, when the phone is done working)?
Here's my code:
I keep seeing this "Ok" button and, if the user clicks it, the alert disappears (before the GPS coordinates are determined, of course). I read some things about the dismiss command of an alert an I think that is the reason for which the Ok command appears. But: how can I just show a "Cancel" command (which quits from the app) and make the progress bar only disappear when the coordinates are found?
public void showProgressBar(final String message)
public void run()
gauge = new Gauge(null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING);
alert = new Alert("Please wait", "", Image.createImage("/images/working.png"), AlertType.ALARM);
// do something
// dispose the alert