BlackBerry Development Fundamentals

What people have said about the book:

New BlackBerry developers are going to love this book! It has everything they need to get started with BlackBerry development. If you’re beginning your first BlackBerry development project – you need to read this book first. If you’ve been doing BlackBerry development for a while, there’s still things you’ll find here that you didn’t know.

Brent Thornton

Home Inside the Book Sample Code Chapter 11 - Hello World Application
Chapter 11 - Hello World Application PDF Print E-mail

The HelloWorld.java application is the starting point for any Java developer. Chapter 11 contains the BlackBerry version of this standard application:

package com.bbdevfundamentals.helloworld;

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

//Create the HelloWorld class
public class HelloWorld extends UiApplication {

 public static void main(String[] args) {
 // Instantiate the HelloWorld object
 HelloWorld hw = new HelloWorld();
 // Enter the Event Dispatcher
 hw.enterEventDispatcher();
 }

 public HelloWorld() {
 // Create the HelloWorldScreen and open it
 pushScreen(new HelloWorldScreen());        
 }
}

final class HelloWorldScreen extends MainScreen {
 public HelloWorldScreen() {
 super();
 // Create the screen's title
 LabelField lblTitle = new LabelField(
 "BlackBerry Development Fundamentals", LabelField.ELLIPSIS
 | LabelField.USE_ALL_WIDTH);
 setTitle(lblTitle);
 // add the text to the screen
 add(new LabelField("Hello readers!"));
 }
}

Attachments:
Download this file (HelloWorld.zip)HelloWorld.zip1 Kb26/10/09 08:59
 
InformIT (Pearson Education)