×

Discussion Board

Results 1 to 2 of 2

Thread: Alert problem

  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    88

    Alert problem

    Hi guys! I have a problem with an Alert
    I connected my phone with a database using a servlet. I would like that while it is trying to connect with the database, it will show an Alert with a gauge.

    this is the code:

    private void infoAlert(Display display)
    {
    Alert info = new Alert("Information","Connecting to the server", null, null);
    info.setTimeout(Alert.FOREVER);
    Gauge indicator = new Gauge (null,false,Gauge.INDEFINITE,Gauge.CONTINUOUS_RUNNING);
    info.setIndicator(indicator);
    display.setCurrent(info);
    }



    I call this method when i try to connect the phone with the server:

    try
    {
    http = (HttpConnection) Connector.open(url);
    http.setRequestMethod(HttpConnection.GET);
    if (http.getResponseCode() == HttpConnection.HTTP_OK)
    {
    infoAlert(display);
    byte servletData[]=null;
    input = http.openInputStream();
    int length = (int) http.getLength();

    if (length > 0)
    {

    ...................
    .....................
    ................
    servletData = new byte[length];
    input.read(servletData);
    .......................
    .......................
    }




    when I get back the data from the server the display will show the form that contains them

    It work on the emulator but on my phone it doesn't work and i got this exception: java.lang.IllegalArgumentException: Alert cannot return to Alert

    I also tryied info.setTimeout(5000);
    but it doesn't work!!!!

    please could someone help me???? Tell me where I do some mistake or tell me some other way to do it??

    thanks
    antonio

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Alert problem

    Instead of setCurrent(Alert), you should use
    setCurrent(Alert alert, Displayable nextDisplayable)
    Requests that this Alert be made current, and that nextDisplayable be made current after the Alert is dismissed.


    Hartti

Similar Threads

  1. Bluetooth - Problem with startInquiry() method
    By a.dionisi in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2006-10-04, 22:01
  2. About 6230 Bt Problem
    By eerkek in forum Bluetooth Technology
    Replies: 17
    Last Post: 2005-02-08, 12:33
  3. Using Alert in MIDP application
    By ram_64892 in forum Mobile Java General
    Replies: 2
    Last Post: 2004-06-11, 01:24
  4. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36
  5. "Application Exiting" problem after setCurrent (alert )
    By gameskitchen in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-06-13, 09:45

Posting Permissions

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