I just want to implement a kind of progress bar, such as the popupscreen or anything else, when i am getting the date via http, the progress bar would be displaying animately (any kind of GaugeField or Thread).

But i cannot make the progress bar moving during the http requesting, can any one give me some suggestion how to implement this?

So far, i put the Http connection in the main thread, and before Http connection, i create the progress bar class, in which contain the thread for counting the value of Guagefield (0~100 and then 0~100 again).

Can't do that. HTTP blocks the main thread - this will a) cause the problem you are seeing, and b) cause your event queue to overflow, resulting in a very rude "App not responsive" exception along with a stack trace.

You put the HTTP in a separate thread, and arrange a listener or callback mechanism to notify the UI thread on progress.

progressScreen.gaugeField.setValue(iterations);
// but i can NOT call doPaint here, so that the progress bar can not be refreshed!!!! invalidate() doesnt make effect
//popup.doPaint();
progressScreen.popup.invalidate();
//******** I can print out this log in the while loop
System.out.println( "invalidate(" + iterations + ")");
}
}
}

}

===============================

Could any one help me to point out the reason why the progress bar can not be refreshed in this way?
I can complete the http connection, just the progress bar can not be updated.

The UI components can only be accessed from the event thread. In order to do what you are trying to do, you would have to place this UI operation in a Runnable, and pass this to UiApplication.invokeLater().

Having said that, I don't see the benefit in having this timer thread arbitrarily updating the progress bar.

Also, I have never called "doPaint" in 1 million lines of Blackberry code - not sure what you are trying to do here.

Why not do something a little simpler?

1. Put the HTTP in a sep. thread
2. Arrange a callback mechanism so the thread can call back to your Screen class
3. Push a modal dialog, "Downloading...please wait"
4. In your callback, use InvokeLater to pop this modal dialog. (remember, this IS NOT the UI thread)

Now, your next line of code after the modal dialog push will execute once the HTTP request is complete.

Thank you for your suggestion. Do you have an example of a callback function? I'm fairly new to Java development on the blackberry and although my HTTP call is in a separate thread and I have my progress bar in a popup screen I'm just not sure when to call it. Thanks in advance for your help!