How to Write a BlackBerry Application - Lesson 3: Create shortcuts and more

How to write a BlackBerry application – Lesson 3: Open a webpage, system-wide menu Item, adding an icon and yes/no dialog

This is lesson 3 in a series of BlackBerry application development lessons. These lessons are intended to bring someone with no experience in developing applications for BlackBerry, up to speed with the latest development techniques. It’s easier than you think so try it out!

Before starting, this lesson, make sure you have read Lesson 1 and Lesson 2.

1.      Go into the folder where your BlackBerry Lections.jdw file is
2.      Create a folder there called Lection 3
3.      Open up your JDE and open the Workspace called Lections.jdw
4.      Right-Click on Lections.jdw
5.      Select Create new Project
6.      Name the Project Lection_3 and save it to the Folder \Lection 3
7.      Copy the two files and into the \Lection 3 folder
8.      In the JDE right-click on Lection_3 and add the two files and into the project

In this Lesson, you learn how to open up a webpage with the default BlackBerry browser. You can use that to create your own Website-Shortcuts or Link to your Homepage straight out of your BlackBerry application.

BlackBerry development
Another thing you learn in this lesson is how to add your own Menu to the System-Menu! Now you can call up your application or do anything else from everywhere in the System. Make sure that you do not add to many Menus to the System-Menu since that can get very confusing for the user.

BlackBerry application

This is what happens when you call up the Menu from anywhere in the System:

BlackBerry app
The third thing you learn is how to add an Icon to your application and how to set the Name for the app.

blackberry app

To add an Icon to the application please do the following:
1. Right-Click on Lection_3 and select Add File to Project
2. Select the file icon.png
3. Right-Click on the newly added file icon.png
4. Click Properties
5. Tick Use as Application Icon
Make sure that the icon you add is about 50×50 pixel and in transparent PNG. I use the software Gimp 2 to edit the icon and to set the transparency.
To set a name for the application you created right-click on Lection_3, select Properties, click on the General-Tab and set the Name in the Title field. There you can also edit the Vendor, Version and Description.

BlackBerry app
Another small feature is a simple Yes/No Dialog. Here is what it looks like:

blackberry dialog
I hope you enjoyed this BlackBerry Development Lesson. Please visit my website at and follow me on Twitter!

Let me know what other topics I should cover in the next Development Lesson!

7 Responses to “How to Write a BlackBerry Application - Lesson 3: Create shortcuts and more”

  1. 1 iskandar_ahmat (Iskandar Ahmat)

    RT @BlackBerryCool: How to Write a BlackBerry Application - Lesson 3: Create shortcuts and more

  2. 2 Tone

    Is there any way for a tutorial on how to add/subtract/etc numbers? For instance how to take input, manipulate the data usign mathametical operands, and then display? I know it is simple, but cannot for the life of me figure it out.


  3. 3 Fabian

    you can do it like that:

    //create new integer
    int i = 83;
    int result = 0;

    result = i * i; //result of 83 * 83

    To get a integer from an EditField you can do the following:

    //first you need to create a new EditField:
    EditField ef = new EditField(”Enter a Number:”,”123″);

    //now, to get the integer from that EditField you do the following:
    int e = Integer.parseInt(ef.getText()); //parsed to Integer
    //make sure that the entered value in the EditField is of type integer

    Now in the ‘e’ Variable you have the value from the Field.
    You can add or subtract it now:

    result = 12313 - e; //the result is 12313 minus the field-entry

    Does it work for you? If not, just post again here!

  4. 4 Tone

    Fabian, that works like a champ! I appreciate the response!
    I have been out of coding for quite a few years, and didn’t have a clue how to do it in Java.

    Thanks again,

  1. 1 How to Write a BlackBerry Application - Lesson 3: Create shortcuts and more « Adrian Francis Weblog
  2. 2 Developer Explains How to Develop BlackBerry Homescreen Website Launchers | »
  3. 3 Créer un raccourci (icone) sur Blackberry | Blackberry FR - Le Blog

Leave a Reply