Blackberry JAVA DEVELOPMENT ENVIRONMENT Getting Started Manual
Blackberry JAVA DEVELOPMENT ENVIRONMENT Getting Started Manual

Blackberry JAVA DEVELOPMENT ENVIRONMENT Getting Started Manual

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

Advertisement

Quick Links

BlackBerry device application
development
Getting started guide

Advertisement

Table of Contents
loading

Summary of Contents for Blackberry JAVA DEVELOPMENT ENVIRONMENT

  • Page 1 BlackBerry device application development Getting started guide...
  • Page 2 Send us your comments on product documentation: https://www.blackberry.com/DocsFeedback. ©2008 Research In Motion Limited. All rights reserved. BlackBerry®, RIM®, Research In Motion®, SureType® and related trademarks, names, and logos are the property of Research In Motion Limited and are registered and/or used as trademarks in the U.S., Canada, and countries around the world.
  • Page 3 OF THE FOLLOWING DAMAGES: DIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, INDIRECT, SPECIAL, PUNITIVE, OR AGGRAVATED DAMAGES, DAMAGES FOR LOSS OF PROFITS OR REVENUES, FAILURE TO REALIZE ANY EXPECTED SAVINGS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, LOSS OF BUSINESS OPPORTUNITY, OR CORRUPTION OR LOSS OF DATA, FAILURES TO TRANSMIT OR RECEIVE ANY DATA, PROBLEMS ASSOCIATED WITH ANY APPLICATIONS USED IN CONJUNCTION WITH RIM PRODUCTS OR SERVICES, DOWNTIME COSTS, LOSS OF THE USE OF RIM PRODUCTS OR SERVICES OR ANY PORTION THEREOF OR OF ANY AIRTIME SERVICES, COST OF SUBSTITUTE GOODS, COSTS OF COVER, FACILITIES OR SERVICES, COST OF CAPITAL, OR OTHER SIMILAR PECUNIARY LOSSES,...
  • Page 5: Table Of Contents

    Create a screen for the HelloWorld application ..................13 Allow the HelloWorld application display a screen................14 Display a message when a BlackBerry smartphone user closes the HelloWorld application ..14 Test the HelloWorld application in the BlackBerry Smartphone Simulator ........14 Code sample: A HelloWorld application ....................15 Create a BlackBerry device application with advanced UI features............16...
  • Page 6 Create a menu item that a BlackBerry smartphone user clicks to display more information about a city they select ............................18 Create a menu item that a BlackBerry smartphone user clicks to close a BlackBerry device appli- cation................................19 Add menu items to the CityInfo application menu ................19 Create a screen that displays information about a city..............20...
  • Page 7: Tools For Creating A Blackberry Device Application

    Device Profile (MIDP) and Connected Limited Device Configuration (CLDC) compliant J2ME environment designed to provide a complete set of APIs and tools for you to develop a BlackBerry device application that runs on BlackBerry smartphones. The BlackBerry Integrated Development Environment, included with the BlackBerry JDE, lets you create a BlackBerry device application using CLDC 1.1 APSI, MIDP 2.0 APIs, and BlackBerry API...
  • Page 8: Prerequisites For Using The Blackberry Jde Plug-In For Eclipse

    The BlackBerry® Java® Development Environment (JDE) and BlackBerry® Java® Development Environment Plug- In for Eclipse™ include multiple tools that you can use to develop BlackBerry device applications. You can also obtain these tools by downloading the BlackBerry Java Development Environment Component Package..
  • Page 9: Blackberry Simulators

    BlackBerry Enterprise Server. Using the BlackBerry Smartphone Simulator with the BlackBerry MDS simulator enables you to test network, push, and browser applications that are designed for use with a BlackBerry Enterprise Server. If you are testing BlackBerry device applications that require an HTTP connection, you need the BlackBerry Smartphone Simulator and the BlackBerry MDS simulator.
  • Page 10: The Blackberry Email Server Simulator

    Smartphone Simulator and either a messaging application, such as Microsoft® Outlook®, or POP3 and SMTP servers. You do not require a BlackBerry® Enterprise Server. You can obtain the BlackBerry email server simulator by downloading the BlackBerry® Java® Development Environment, the BlackBerry® Java® Development Environment Plug-In for Eclipse™, or the BlackBerry Email and MDS Services Simulator Package from the...
  • Page 11: Creating A Blackberry Device Application

    Create a basic BlackBerry device application In this section, you create a BlackBerry® device application that displays the text ‘Hello World!’ on the BlackBerry smartphone screen. When a BlackBerry smartphone user selects the Close menu item from the menu of the BlackBerry device application , the BlackBerry device application displays a dialog box with the text ‘Goodbye!’.
  • Page 12: Add .Java Source Files To The Project For The Helloworld Application

    HelloWorld extends UiApplication 2. Create a constructor for the HelloWorld class. public HelloWorld() { Allow the HelloWorld application start sending and receiving events when the application starts UiApplication class is the base class for all BlackBerry® device applications that provide a UI.
  • Page 13: Create A Screen For The Helloworld Application

    As it pushes screens onto the stack, it draws them on top of any other screens already on the stack. When a BlackBerry device application pops a screen off the stack, it redraws the underlying screens as necessary. Only the screen on the top of the stack receives input events.
  • Page 14: Allow The Helloworld Application Display A Screen

    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!.
  • Page 15: Code Sample: A Helloworld Application

    The following sample code pulls together the tasks in this section into an BlackBerry® device application that displays the text ‘Hello World!’ on the BlackBerry smartphone screen and displays a dialog box with the text ‘Goodbye!’ when the BlackBerry device application closes.
  • Page 16: Create A Blackberry Device Application With Advanced Ui Features

    Getting started guide //Add the text "Hello World!" to the screen. add(new RichTextField("Hello World!")); //To display a dialog box to a BlackBerry smartphone user with the text //"Goodbye!" when the BlackBerry smartphone user closes the BlackBerry device application, override the onClose() method.
  • Page 17: Add .Java Source Files To The Project For The Cityinfo Application

    2: Create a BlackBerry device application with advanced UI features 10. Click OK. Add .java source files to the project for the CityInfo application The .java source file name must match the name of the public class or interface in the file. It must also be located in a folder structure that matches its package name.
  • Page 18: Create A Screen For The Cityinfo Application

    API Reference for more information. Create a menu item that a BlackBerry smartphone user clicks to display more information about a city they select When a BlackBerry® smartphone user selects a menu item from the menu of a BlackBerry device application, the run() MenuItem code in the method for the menu item executes.
  • Page 19: Create A Menu Item That A Blackberry Smartphone User Clicks To Close A Blackberry Device Application

    BlackBerry smartphone user selects from a choiceField drop-down list. Invoking UiApplication.getUiApplication.pushScreen(_infoScreen) lets a BlackBerry device application use an instance of itself to display a screen with information on the city a BlackBerry smartphone user selects from a drop-down list. choiceField...
  • Page 20: Create A Screen That Displays Information About A City

    2. In the first line of the constructor for the inner class, invoke the constructor of the MainScreen class. super(); 3. To display a label with the name of the city the BlackBerry® smartphone user selects, in the constructor for the inner class, create a LabelField LabelField lf = new LabelField();...
  • Page 21: Allow The Cityinfo Application Set The Values Of Ui Fields With City Information

    Allow the CityInfo application set the values of UI fields with city information > In the constructor for the inner class, use a select clause to control the actions that the BlackBerry® device application performs when a BlackBerry smartphone user selects a city from the menu of the BlackBerry BasicEditField.setText()
  • Page 22: Code Sample: A Blackberry Device Application That Displays Information On A City The User Selects

    Getting started guide Code sample: A BlackBerry device application that displays information on a city the user selects Example: * CityInfo.java * Copyright (C) 2001-2008 Research In Motion Limited. All rights reserved. package com.rim.samples.cityinfo; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*;...
  • Page 23 BlackBerry device application. private MenuItem _closeItem = new MenuItem("Close", 200000, 10) { public void run() onClose(); //To add menu items to the menu of the BlackBerry device application, override the makeMenu method. protected void makeMenu( Menu menu, int instance ) menu.add(_viewItem);...
  • Page 24 BasicEditField sightsField = new BasicEditField("Sights: ", null, 50, Field.READONLY); add(lf); add(new SeparatorField()); add(popField); add(stateField); add(sightsField); //Populate fields with data for the city the BlackBerry smartphone user //selects. The 'select' variable stores the value for the city. if (select == 0) { lf.setText("Los Angeles"); popField.setText("3,694,820"); stateField.setText("California");...
  • Page 25: Testing A Blackberry Device Application

    The .cod file that results provides services that are similar to those that obfuscation packages provide in an effort to reduce the size of the .cod file. For example, the BlackBerry Java Development Environment removes the following information from a .cod file:...
  • Page 26: Testing A Blackberry Device Application On A Blackberry Smartphone Simulator

    Parameter Description port A BlackBerry smartphone PIN if the BlackBerry smartphone connects to a USB port. You must also specify the -usb option. password This paramter specifies the password for the BlackBerry smartphone, if a password for the BlackBerry smartphone is set.
  • Page 27 .jad file on the BlackBerry javaloader [-u] load .jad file smartphone. For example: javaloader.exe -u load My.jad Javaloader loads the .cod files listed in the .jad file onto the BlackBerry smartphone. Remove a BlackBerry device application .cod file >...
  • Page 28 Getting started guide...
  • Page 29: Distributing A Blackberry Device Application

    With the BlackBerry® Application Web Loader, you can post your compiled application on a central web site and users can se tup the application by using Internet Explorer on their computers to the visit URL. When BlackBerry smartphone users visit the web page, The BlackBerry Application Web Loader asks them to connect their smartphones to the USB port.
  • Page 30: Wireless Pull (User-Initiated)

    Getting started guide Wireless pull (user-initiated) You can post a compiled applications on a public or private web site, and BlackBerry® smartphone users can download the applications over the wireless network by using the web browser on their BlackBerry smartphones to visit the URL.
  • Page 32 ©2008 Research In Motion Limited Published in Canada.

Table of Contents