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!
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 HelloWorld.java and Lesson3Screen.java into the \Lection 3 folder
8. In the JDE right-click on Lection_3 and add the two files HelloWorld.java and Lesson3Screen.java 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.
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.
This is what happens when you call up the Menu from anywhere in the System:
The third thing you learn is how to add an Icon to your application and how to set the Name for the 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.
Another small feature is a simple Yes/No Dialog. Here is what it looks like:
Let me know what other topics I should cover in the next Development Lesson!