View Single Post
Old 10-01-2009, 12:56 AM   #6 (permalink)
New Member
Join Date: Aug 2009
Model: 8300
Carrier: None
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts

Create a new project and use the following code. Initially, set a breakpoint on the first statement HelloWorld theApp = new HelloWorld(); and debug the application. Also avoid using image at the first go.

 * Copyright (C) 2001-2003 Research In Motion Limited. All rights reserved.
package com.rim.samples.helloworld;

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.*;

 * BlackBerry applications that provide a user interface
 * must extend UiApplication.
public class HelloWorld extends UiApplication
        public static void main(String[] args)
                //create a new instance of the application
                //and start the application on the event thread
                HelloWorld theApp = new HelloWorld();
        public HelloWorld()
                //display a new screen
                pushScreen(new HelloWorldScreen());

//create a new screen that extends MainScreen, which provides
//default standard behavior for BlackBerry applications
final class HelloWorldScreen extends MainScreen
        public HelloWorldScreen()

                //invoke the MainScreen constructor

                //add a title to the screen
                LabelField title = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS
                                | LabelField.USE_ALL_WIDTH);

                //add the text "Hello World!" to the screen
                add(new RichTextField("Hello World!"));

        //override the onClose() method to display a dialog box to the user
        //with "Goodbye!" when the application is closed
        public boolean onClose()
            return true;

Offline   Reply With Quote