Simple example of WaitScreen component
By lukas on Mar 07, 2006
Open Properties of the new SimpleCancellableTask and you can define Executable Method Body. The Executable Method Body is the code that will run on the background when the WaitScreen appears on the screen of the device. Note that the WaitScreen can end either with Failure or with Success. When the SimpleCancellableTask ends without an exception then it will continue to the Success screen otherwise it will go to the Failure screen.
I created a simple example that connect to internet and shows a price of a stock. I reused some codes from QuotesMIDlet.java
The main problem that found when I was creating the example was that the simpleShockPriceTextBox component is created and used in setNextDisplayable method of the WaitScreen before the data are downloaded from network. I had to add call of setString(...) of the showShockPriceTextBox at the end of the Executable Method Body of the SimpleCancellableTask. It updated the value correctly.
I tried a different approach before. I set showShockPriceTextBox=null and hoped that it will re-create the component again with the right values but it didn't worked in that way