10-02-2008 01:51 PM
Well... I think you just solved all my problems!
I wasn't familiar with all this... but now I think the next application will be much easier! These are really some neat things to know.
One last question, since I have this about screen that will always be in the switch list, would it be possible to write stuff on it while keeping it in the background?
For example, I could write the "Last Updated" date/time on the screen everytime my code is executed (I have a permanent loop with a sleep) and leave it in the backgroud.... so when the user click on the icon or select it from the switch list, he'll see when was the last udpated time.
I know how to write the date to the screen... I just want to make sure what is the proper way to write to the screen using a background thread when the screen is not in the foreground.
Thanks a bunch!
10-02-2008 02:39 PM
There is no problem with doing what you want, i.e. updating the Screen, however to do this you need to have the EventLock, and the easiest way to do that is to do the standard
However this will actually start a new Thread (at least I think it does, it will certainly have to schedule a Thread), and that seems a little bit of overkill for updating a screen, that might not even be viewed before you update it the next time.
So instead, I would recommend that you use the onExposed() method of MainScreen. I'm pretty sure this runs with the EventThread already, so in that routine you can update the screen with the current update time. So it only gets updated when someone is watching.
If you did what you were suggesting (i.e. update in each loop), then the screen would get updated as the user was watching it, which could be a good thing. But I personally think the overhead is not justified. Instead, put an update button on the screen, and the user can click on that to see if the time you are displaying is actually updating. And all your button has to do, is call onExposed()!
Do you need an icon on the screen for this application. You could make it a System module.
10-02-2008 05:25 PM
I tried both suggestion... mine that updates on each loop and yours that updates only when the application is exposed... and they both work fine! I'll probably end up using yours for the reasons you specified.
I can't thank you enough for all your quality answers! You didn't just help me achieve what I had to do... but you also made me understand all this!
Thanks a lot!
10-15-2008 11:09 AM