×

Discussion Board

Results 1 to 3 of 3

Thread: Custom Alert

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    3

    Lightbulb Custom Alert

    Hello everyone,

    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:



    Code:
    public void showProgressBar(final String message)
        {
            new Thread()
            {
                public void run()
                {
                        Alert alert;
                        Gauge gauge;
                        gauge = new Gauge(null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING);
                        alert = new Alert("Please wait", "", Image.createImage("/images/working.png"), AlertType.ALARM);
                        alert.setString(message);
                        alert.setIndicator(gauge);
                        alert.setTimeout(Alert.FOREVER);
                        toDisplayOn.setCurrent(alert, returnScreen);
    
                        // do something
    
                        // dispose the alert
                }
            }.start();
        }
    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?

    Any ideas?

  2. #2
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: Custom Alert

    first, i think you don't really want to have your user stuck in front of an undismissable alert for more than, say 5 seconds (not to mention 3 minutes). moreover, gps position can be quite long to aquire (or even to fail to aquire), so you will probably want to do that in background.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    3

    Re: Custom Alert

    In my application, there is no "next step" without any GPS coordinates. If the coordinates cannot be determined, then the application should handle this somehow. What this "somehow" will be, remains to be decided. First, I need to see how to control such Alerts.

Similar Threads

  1. Custom control doesn't display in a custom dialog
    By curiouswalker in forum Symbian User Interface
    Replies: 9
    Last Post: 2010-07-14, 06:20
  2. Replies: 3
    Last Post: 2009-07-02, 12:44
  3. Replies: 2
    Last Post: 2008-06-13, 19:24
  4. Custom Alert Component Please Help!!!!!!
    By HidayathKhan in forum Symbian
    Replies: 2
    Last Post: 2007-10-25, 15:05
  5. Using skins! Custom Listbox / Custom ListItemDrawer
    By akrapacs in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-22, 10:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×