Allow The Helloworld Application Display A Screen; Display A Message When A Blackberry Smartphone User Closes The Helloworld Application; Test The Helloworld Application In The Blackberry Smartphone Simulator - Blackberry JAVA DEVELOPMENT ENVIRONMENT Getting Started Manual

Device application development
Hide thumbs Also See for JAVA DEVELOPMENT ENVIRONMENT:
Table of Contents

Advertisement

Getting started guide
3. In the constructor, add the following code:
super();
LabelField title = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS |
LabelField.USE_ALL_WIDTH);
setTitle(title);
add(new RichTextField("Hello World!"));

Allow the HelloWorld application display a screen

pushScreen()
The
method is inherited from the
and paints it. The BlackBerry® JVM maintains screens in a display stack. See
information.
HelloWorld
>
In the
//display a new screen
pushScreen(new HelloWorldScreen());
Display a message when a BlackBerry smartphone user closes the HelloWorld
application
The
onClose()
method is inherited from the
a close event has occurred.
The
Dialog.alert()
method creates an alert dialog box that a BlackBerry device application can use to notify a
BlackBerry smartphone user of an event or some important information. The dialog uses an exclamation mark
bitmap. See
Dialog
in the API Reference for more information.
>
In the HelloWorldScreen class, overide the onClose() method using the following code:
public boolean onClose()
{ Dialog.alert("Goodbye!");
System.exit(0);
return true;
}

Test the HelloWorld application in the BlackBerry Smartphone Simulator

1.
From the Run menu, click Run As > BlackBerry Simulator.
2. In the Choose a launch Configuration dialog box, select a launch configuration.
3. Press OK.
4. From the HomeScreen of the BlackBerry® Smartphone Simulator, select and open the HelloWorld . The
BlackBerry device application displays the text HelloWorld!.
5. From the FullMenu of the BlackBerry device application, select the Close menu item. The BlackBerry device
application displays a dialog with the text Goodbye!.
14
constructor, add the following code:
Screen
UiApplication
class and pushes a screen onto the display stack
class and indicates to an BlackBerry® device application that
Screen
in the API Reference for more

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the JAVA DEVELOPMENT ENVIRONMENT and is the answer not in the manual?

Questions and answers

Table of Contents