BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 05-05-2008, 07:52 PM   #1 (permalink)
Knows Where the Search Button Is
Join Date: Apr 2008
Model: 7100T
Carrier: optus
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Screen not updating

Please Login to Remove!

Hi guys, can anyone spot whats wrong, why does my invocation of 'app.showMessage', not update the screen? I really don't understand screens, an explanation would be much appreciated.

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;

public class HelloApp extends UiApplication {
    //Screen instance
    HelloScreen screen;
    public static void main(String argv[]) {
        HelloApp app = new HelloApp();
        app.showMessage("Screen updated!");

    public HelloApp() {
        screen = new HelloScreen();
    public void showMessage(final String msg){
       UiApplication.getApplication().invokeLater(new Runnable() {
          public void run(){
             //Display dialog with message.
             //force repaint of screen.

}//End of Hello App class

class HelloScreen extends MainScreen {
    public HelloScreen() {
         LabelField title = new LabelField
         ("Sms reciever", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        RichTextField text = new RichTextField("Waiting for sms...\n");
}//End of HelloScreen class


Just a quick update, it does seem that event dispatcher blocks? If I try the following:

    public static void main(String argv[]) {
        HelloApp app = new HelloApp();
        app.showMessage("Screen updated 1");
        app.showMessage("Screen updated 2");
I get the first dialog message and not the second. Can anyone explain to me why this is? How would I got about getting the second message to display?

Last edited by skynetchris : 05-05-2008 at 09:39 PM. Reason: Update
Old 05-06-2008, 02:29 AM   #2 (permalink)
CrackBerry Addict
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts

if you use dialog you push a new, modal screen. you don't have to invalidate your screen as there is nothing changed on it.

public void enterEventDispatcher()
Enters the event dispatcher.

The thread that calls this method (typically the main thread in the application) becomes the event-dispatching thread, which will execute all drawing and event-handling code.

Note that under normal circumstances this method does not return.
As the method does not return everything below is never executed. Put your code into the constructor of your application to get it executed.
java developer, Devinto, hamburg/germany

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.