Want to develop apps for the Blackberry handheld devices on the market in Australia? Try this "Hello World" primer from David McAmis.

The BlackBerry Personal Information Manager (PIM) is a portable device that connects users to corporate e-mail and other systems across a wireless connection, providing instant, 24x7 access to business critical information.

Here in Australia, BlackBerry devices have been available for a while exclusively through Telstra, but that is all about to change, with the introduction of Blackberry devices and services from a number of other wireless providers like Vodafone coming soon.

To start, you will need to have the latest edition of the Java 2 Platform SDK (currently 1.4.2.04) which you can download from Sun's Web site. The SDK installation will take a few minutes and requires approximately 120mb of hard drive space, but will provide all of the tools you need to compile your BlackBerry applications.

Next, you will need to install the BlackBerry Java Development Environment (currently version 3.7) which you can download from the BlackBerry Developer Web site. This installation is also straight-forward and requires 77mb of hard drive space. Use the -Complete" installation option to install all of the documentation, sample code and program files, as well as simulators for client and server components.

You can use the client simulator to test how your application will behave when loaded onto a BlackBerry device, as shown below in Figure A


Figure A
The BlackBerry Client Simulator

The tools will be installed in the Start menu under a program group named -Research in Motion", with sub-menus containing all of the BlackBerry tools. From the sub-menu, select the option to open the JDE, which will open the window shown in Figure B with a workspace and a number of sample applications that you can view.


Figure B
The JDE Window

Creating a New Application
To create your own workspace, select File > New Workspace and give your workspace a name and location. Workspaces have a .JDW extension and a workspace file will be created in the location you specify.

Next you will want to create a project.

In this example we are going to walk through the classic -Hello World" project to demonstrate how the BlackBerry JDK works. To create a new project, select Project > Create a New Project. Enter a name for your project, as well as a file path. For this example, we are going to be original and call the project -Hello World"

Now that we have created a project, we need to add some Java code to our project. To add this code, we are going to create an external .JAVA file that contains the code we need. We are going to name this file -HelloWorld.JAVA" and you can create it using Notepad or the text editor of your choice.

Normally, in a Java application you would use the import statement to add the different Java classes that you wanted to reference. Since the BlackBerry uses Java 2 Mobile Edition, all of the classes from J2ME are available to you. In addition, there are a number of classes that are unique to BlackBerry that we need to add to interface with the user interface, device resources, etc.

So the first part of your code would look something like this:

Editor's note: You can find a description of all of these classes in the documentation that is included with the JDK

Next, we need to create a custom class for our Hello World application, create the application and use the -pushScreen" method to make our application appear as the active application.

And finally, we can get down to actually putting in the elements we would like to see on the screen, starting with the default menu options and a close option. We are also going to use the setTitle method to set the title that should appear the top of our application.

We also need to set the behaviour for when the user closes the application. In this case, we are going to trap for the Escape button on the side of the BlackBerry device and when they close the application or press the Escape button, we are going to display some text and close the application using the code below:

With your HelloWorld.java file added to the project, our next order of business is to add an icon that will appear on the BlackBerry desktop to launch our application. Your icon should be 28x28 pixels and should be saved in a single-layer PNG or GIF file. For this example, we have created our own icon file and you can easily do the same using your favourite graphics or icon editing program.

To add the icon, right-click on your project and select Add File to Project and then browse and select the icon file provided.

Building and Deploying your Application
With all of the components in place, we are ready to build and deploy your application to your BlackBerry device. From within the JDE, select Debug > Go to start the build process. The progress of the build will appear in the status window at the bottom of the JDE.

Once the Build process has completed successfully, the client simulator will open and display your application, as shown below in Figure C


Figure C
The simulator with the application running

You can use the simulator to test your application and ensure that the program runs as expected. In this example, you should be able to use the controls on the simulator to scroll to your program icon and use the return key to launch it. It should display the text "Hello World" on the Blackberry screen. To exit the program, use your mouse to click the Escape button on the side or use the ESC key on your keyboard.

Deploying Your Application
Since we have developed this application using the Blackberry JDE, deployment is pretty easy. When you build your application, the development environment builds the .JAD ("Java Application Descriptor" ) file that is required to distribute your application along with the required .COD files

The easiest way to distribute these files is to make them available on a Web server that your Blackberry users can access. Before you can publish these files you will need to do some configuration on the Web server to make this happen. On your Web server MIME settings, you will need to ensure that you have the following settings:

.JAD         text/vnd.sun.j2me.ap-descriptor
.COD         application/vnd.rim.cod

You can then give users a URL that points to the .JAD file. When they browse this file from their Blackberry it will trigger the installation of the program you have created.

This is a very simple application exampleâ€"given that the Blackberry uses Java, you can develop just about any application that you can imagine. If you want to know more about developing for this platform there are a number of resources for Blackberry developers, including the Blackberry Developer Web Site and a number of third-party sites as well. The Blackberry Developer site has a comprehensive knowledge base of articles, as well as developer documentation and forums.

Further reading:

Do you need help with Embedded/Mobile? Gain advice from Builder AU forums

Related links

Comments

1

satish - 05/03/07

when run HelloWorld example it not run on JDE simulator , and also it does not display any icon in appliction

» Report offensive content

2

Nidhi - 21/08/07

Send flowers and gifts all over India.Visit www.Gifts-to-India.com

» Report offensive content

3

Shijil - 13/09/07

Send Gifts to Dubai, Flowers to Dubai, gifts to Sharjah, Flowers to Sharjah, Gifts to Abu Dhabi,UAE by Dubai Gifts Mall.
http://www.dubaigiftsmall.com

» Report offensive content

4

su - 18/09/07

Great Sevice Messages sent on Black berry http://www.sendflowerstohyderabad.com/

» Report offensive content

5

annie - 19/09/07

send fresh flowers,gifts,cakes,chocolates,teddys anywhere in India through this site.visit www.IndiaFlowersGifts.com

» Report offensive content

6

Abhishek - 19/09/07

send fresh flowers anywhere in Singapore through this site.visit www.SingaporeFlowerShop.com

» Report offensive content

7

sana - 27/09/07

send flowers n gifts all over USA.visit www.GiftFlowersUSA.com

» Report offensive content

8

ryan - 27/09/07

send flowers n gifts all over Mexico.visit www.MexFlores.com

» Report offensive content

9

abha - 27/09/07

flowers to india
Use black berry very useful

» Report offensive content

10

abha - 27/09/07

flowers to india
Use black berry very useful

» Report offensive content

11

abha - 27/09/07

flowers to india
Use black berry very useful

» Report offensive content

12

abha - 27/09/07

flowers to india
Use black berry very useful

» Report offensive content

13

abha - 27/09/07

flowers to india
Use black berry very useful

» Report offensive content

14

Raman - 05/11/07

all these sites use black berry, it is most wonderful thing that could happen in mobile business

» Report offensive content

15

avik - 07/11/07

this is a very good site.send flowers n gifts all over Japan,visit www.JapanFloristShop.com

» Report offensive content

16

Piu Roy - 14/01/08

This is a great site. Send fresh flowers, cakes, chocolates,dry & fresh fruits, cute teddy bears, apparels etc. to your near & dear ones all over India.
Visit www.IndiaFlowersGifts.com

» Report offensive content

17

Piya De - 14/01/08

This is a nice site. Send fresh flowers, cakes, chocolates,dry & fresh fruits, cute teddy bears, wine etc. to your loved ones all over Singapore. Visit www.SingaporeFlowerShop.com

» Report offensive content

18

Mampi De - 21/01/08

This is a nice site to go through. Send fresh flowers, cakes, chocolates, fresh fruits, wine, exclusive hampers, gifts to your loved ones across USA. Visit www.GiftFlowersUSA.com

» Report offensive content

19

Mampi De - 21/01/08

This is a nice site to go through. Send fresh flowers, cakes, chocolates, fresh fruits, wine, exclusive hampers, gifts to your loved ones across USA. Visit www.GiftFlowersUSA.com

» Report offensive content

20

Mistu Ray - 21/01/08

This is a very nice site. Send beautiful flowers, fresh fruits, chocolates, wine, cute teddy bears, exclusive gifts to your near & dear ones across Mexico. Visit www.MexFlores.com

» Report offensive content

21

Ann De - 25/01/08

This is a very nice site.

» Report offensive content

22

Hillol Ray - 31/01/08

This is a very nice site. Send fresh flowers, roses, fresh fruits, exclusive gifts & hampers to your loved ones across Brazil. Visit www.FloresBrazil.com

» Report offensive content

23

Hillol Ray - 31/01/08

This is a very nice site. Send fresh flowers, roses, fresh fruits, exclusive gifts & hampers to your loved ones across Brazil. Visit www.FloresBrazil.com

» Report offensive content

24

Hillol Ray - 31/01/08

This is a very nice site. Send fresh flowers, roses, fresh fruits, exclusive gifts & hampers to your loved ones across Brazil. Visit www.FloresBrazil.com

» Report offensive content

25

Hiya Deb - 31/01/08

This is a nice site to go through. Send roses, bouquet, fresh fruits, plants, beautiful gifts to your loved ones across Italy. Visit www.FioriItaly.com

» Report offensive content

26

Keya Dutt - 04/02/08

This is a nice site to go through. Send beautiful flowers, cakes, chocolates, dry n fresh fruits, apparels, combo gifts to your near & dear ones all over Kolkata. Visit www.KolkataOnlineFlorists.com

» Report offensive content

27

Pom Pal - 04/02/08

This is a very nice site. Send fresh flowers, cakes, fresh & dry fruits, chocolates, exclusive gifts to your loved ones across Pune.
Visit www.PuneOnlineFlorists.com

» Report offensive content

28

Gitu Goel - 08/02/08

This is a very nice site. Send fresh flowers, cakes,
fresh & dry fruits, chocolates, exclusive gifts to your
loved ones across Goa . Visit www.Goafloristshop.com

» Report offensive content

29

gaurav singal - 15/02/08

Content and website are good http://www.uponnet.com

» Report offensive content

30

Nona shivangi - 19/02/08

I liked the content on this site. Would like to visit again.

» Report offensive content

31

Amit Roy - 28/03/08

This is a nice site to go through. Send beautiful
flowers, chocolates, dry n fresh fruits, cakes,
apparels, jewellery, gift coupons, combo gifts
to your near & dear ones all over Ahmedabad.
Visit www.AhmedabadOnlineFlorists.com

» Report offensive content

32

Tabbu De - 28/03/08

This is a very nice site. Send fresh bouquet,
roses, fresh fruits, gourmet hampers, exclusive gifts
to your loved ones across Italy. Visit www.FioriItaly.com

» Report offensive content

33

Isha Roy - 30/04/08

This is a very nice site. Send fresh flowers, cakes,
fresh & dry fruits, chocolates, puja items, watches,
cosmetics, combo gifts and more to your loved ones
across India. Visit www.IndiaFloristNetwork.com

» Report offensive content

34

Goutam Das - 30/04/08

This is a nice site to go through. Send fresh flowers
& fruits, chocolates, cakes, sweets, gift coupons,
apparels, jewellery, cosmetics, electronics, puja
items and many beautiful gifts to your near & dear
ones all over India. Visit www.Gifts-To-India.com

» Report offensive content

35

Goutam Das - 30/04/08

This is a nice site to go through. Send fresh flowers
& fruits, chocolates, cakes, sweets, gift coupons,
apparels, jewellery, cosmetics, electronics, puja
items and many beautiful gifts to your near & dear
ones all over India. Visit www.Gifts-To-India.com

» Report offensive content

36

suba jana - 12/07/08

Shop online from any part of the world to send Gifts to Pune, Flowers to Pune, Cakes to Pune for all Occasions on all 7 days visit - http://www.puneonlinemall.com

» Report offensive content

37

kamolika - 25/03/09

http://www.mexflores.com
Send gifts to India, Online delivery of flowers to India, gift to India, chocolates, cakes, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to Bangalore, Chennai, Delhi, Pune, Hyderabad, Kerala, Mumbai, Mithai Same day delivery to India, Gift Shop.

» Report offensive content

38

tamanna som - 22/04/09

http://www.gifts-to-india.com
Send gifts to india, Online delivery of flowers to india, gift to india, chocolates, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to Bangalore, Chennai, Delhi, Pune, Hyderabad, Kerala, Mumbai, Mithai Same day delivery to India, Gift Shop.

» Report offensive content

39

anamika - 22/04/09

http://www.spainflorist.com
Send gifts to Spain, Online delivery of flowers to Spain, gift to Spain, chocolates, cakes, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to Spain, Same day delivery to Spain, Gift Shop.

» Report offensive content

40

gift to germanyflowershop - 27/04/09

http://www.germanyflowershop.com
Send gifts togermanyflowershop. Online delivery of flowers to Germanyflowershop, gift to germanyflowershop .chocolates, cakes, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to germanyflowershop.

Send gifts togermanyflowershop.  Online delivery of flowers to Germanyflowershop, gift to germanyflowershop .chocolates, cakes, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to germanyflowershop.

» Report offensive content

41

tamanna som - 28/04/09

http://www.japanfloristshop.com
Send gifts to Japan, Online delivery of flowers to Japan gift to Japan, chocolates, watches, teddy, sweets, fresh fruits, dry fruits to Japan.
Anniversary, birthday, wedding gifts, cakes to Japan

» Report offensive content

42

Madhu - 12/05/09

indiaflowerplaza.com helps you to order to send flowers to India online, Gifts to India from US, Cakes to India, Birthday Gifts to India Flowers to India from USA, Gifts to India online, Mothers Day Gifts to India , flowers to India same day delivery.

» Report offensive content

43

riya - 16/05/09

http://www.gifts-to-india.com
Send gifts to India, Online delivery of flowers to India, gift to India, chocolates, cakes, watches, teddy, sweets, fresh fruits, dry fruits.
Anniversary, birthday, wedding gifts, cakes to Bangalore, Chennai, Delhi, Pune, Hyderabad, Kerala, Mumbai, Mithai Same day delivery to India, Gift Shop.

» Report offensive content

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

43

riya - 16/05/09

http://www.gifts-to-india.com Send gifts to India, Online delivery of flowers to India, gift to India, chocolates, cakes, watches, teddy, sweets, fresh fruits, dry ... more

42

Madhu - 05/12/09

indiaflowerplaza.com helps you to order to send flowers to India online, Gifts to India from US, Cakes to India, Birthday Gifts ... more

41

tamanna som - 28/04/09

http://www.japanfloristshop.com Send gifts to Japan, Online delivery of flowers to Japan gift to Japan, chocolates, watches, teddy, sweets, fresh ... more

Log in


Sign up | Forgot your password?

  • Staff Aussies to pay more for Win 7

    If you are looking to make some money in these troubled times, perhaps importing copies of Windows 7 could be for you. Read more »

    -- posted by Staff

  • Staff Firefox: Greens want it, 3.5rc2 not up to par

    This week's roundup looks at the situation surrounding a campaign to change Outlook HTML renderer, a Greens MP wants to install Firefox but is restricted and all the photos from the iPhone 3GS launch. Read more »

    -- posted by Staff

  • Chris Duckett Microsoft misses the Outlook point

    Ask designers which mail program is the bane of their existence, and you'll find that Outlook tops the list. The reason why the most popular email reader is also the most painful is simple: it uses Word to render HTML emails. Read more »

    -- posted by Chris Duckett

What's on?