BlackBerry Application Development Tutorial (Part-3) Aasim Naseem, October 17, 2009 | Read Count: 16,431April 29, 2025 Category: My Tutorials > BlackBerryHello All; I wish you receive this post in the best of everything. This is the 3rd part of the BlackBerry Application Development Tutorial series. First of all, accept my apology for posting this post so late. I was busy with some other projects, and hence couldn’t find enough time to compose it. I delayed this task for this weekend, and now it’s ready for you. Note: This tutorial is a part of a series of my tutorials on BlackBerry application development; so far we have discussed the following. Introduction :: BlackBerry Application Development Setting Up Your System :: BlackBerry Application Development Tutorial (Part-2) Your First Application :: BlackBerry Application Development Tutorial (Part-3) Creating A WebIcon :: BlackBerry Application Development Tutorial (Part-4) The pre-request of this tutorial is BlackBerry Application Development Tutorial (Part-2) for setting your system to start bBlackBerryapplication development. Before start, I’m assuming that you have configure the Sun JDK, Eclipse SDK, BlackBerry JDE Plug-in for Eclipse and BlackBerry JDE Component Packs successfully on your system … is that? Kindly confirm again … Orite, its time to move forward. Bring a cup of coffee, some cookies, play some light song in your favorite music player …. I think some instrumental number will good … Hmm now you are ready to get start .. .good … start eclipse and make a new workspace for your blackberry projects. Alright, next is to create a new project. As you have already installed the JDE plug-in for Eclipse, you will see an entry of “BlackBerry Project” in the Create New Project window. Click next. Chose your project name, but for god sake, don’t use HelloWorld type words… its time to say good by to Hello World … do something new, dude … ummm use “WelcomeBlackBerry.” Hmm, that’s nice … Chose default location; it will save project in your workspace folder… Click next and finish. It’s better… in fact, I recommend configuring your project or workspace. Chose configure blackberry workspace and set options like vendor, version, etc. In install component, choose the BlackBerry JDE Component Packs option. Great. You have set your workspace for BlackBerry applications. Take a sip of coffee and take a bite of cookie. Now its time to learn few concepts … keep your coffee mug in your hand and concentrate on the following paragraph. Keep taking sips of coffee. PUSH/POP of Screens Every software application has different pages to display different information and components for user interactions like buttons, text fields etc. In BlackBerry applications, we will call them as screens. Mean we will design and develop different screens and will link them via different events like clicking a button will hide one page(screen) and will show other page (screen). This show/hide phenomenon in blackberry’s program is called pus and pop of a screen. Push mean displaying a screen and Pop means hide it. Its means when we want to display a screen, we first pop top screen and then push that screen we want to show. Hence application is behaving like a stack where we are push and pop screen and maintain a flow of screen as per events triggered by user. Got the idea? No!!! don’t worry. Read the above paragraph again and when clear move to next one. It’s quite simple han … Your First program for BlackBerry Now create a new package blackberry and create new Class. Name the new class “FirstBlackBerryClass” Every class that use user interaction controls must implement a class UiApplication (net.rim.device.api.ui.UiApplication). hey don’t smile .. I know the same class is available in iPhone sdk too, for same purpose 🙂 Ok, you have created a class, have implement UiApplication. Now make a main() method to have entry point of the our application. This main method is same as traditional java classes … yes, you got it. Its our public static void main (String[] args) at this point our class should look like package com.iainteractive.blackberry; import net.rim.device.api.ui.UiApplication; public FirstBlackBerryClass extends UiApplication { public static void main(String[] args) { } public FirstBlackBerryClass() { } } Now in main method, creates an instance/object of your class and calls enterEventDispatcher(), inherited from UiApplication class. This method starts event handling and executes all drawing and event-handling code. Now your class should look like com.iainteractive.blackberry; import net.rim.device.api.ui.UiApplication; public FirstBlackBerryClass extends UiApplication { public static void main(String[] args) { WelcomeBlackBerry firstApplication  = new WelcomeBlackBerry(); firstApplication.enterEventDispatcher(); } public FirstBlackBerryClass(){ } } Our class is read to execute, means at very very basic level you can say you have created your first application.Though it will do nothing. Now its time to add some screen. When our program will run, we should make sure that we have push a screen so that when application start execution, user can see something over his device. To do so, we will first create a screen and then will link it to our main class .i.e. FirstBlackBerryClass. Creating a Screen Blackberry API provides a class name MainScreen that provides features common to standard RIM device applications like a title section, a separator element, and a main scrollable section (actually a single vertical field manager used to maintain a list of fields). So every class that behave like screen or in other words, every screen must extends MainScreen class to get access to different screen sections. So our next task is to develop a screen class. Add new class in package, name it as FirstScreen package com.iainteractive.blackberry; import net.rim.device.api.ui.container.MainScreen; final class FirstScreen extends MainScreen { FirstScreen(){ } } Now we will add some element to display. First important thing is title for your application. For this, use LabelField class object and set some string as title. Then set this label as application’s title. LabelField appTitle = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); this.setTitle(appTitle); now to add some text over the screen, use RichTextField class and pass some string to display. RichTextField  greeting = new RichTextField("its running… great"); Now add it to screen by add() method of MainScreen class. this.add(greeting); now our FirstScreen class will look like that final class FirstScreen extends MainScreen { FirstScreen(){ LabelField appTitle = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); this.setTitle(appTitle); RichTextField  greeting = new RichTextField("its running… great “); this.add(greeting); } } Our screen is ready. Now time is to link it with our main program .i.e. FirstBlackBerryClass. We have learned that to show a screen in blackberry application, we have to push it, so to show our FirstScreen, we will push it to in our FirstBlackBerryClass class. For this we will use pushScreen method of UiApplication class that takes a reference of a Screen object. We will call this method in constructor of our FirstBlackBerryClass class so that as soon as our application run, it push our screen to display on user’s device. Now go back to FirstBlackBerryClass class’s constructor and the following line there. pushScreen(new FirstScreen()); its done … we have done .. now our final code should look like that //====================== package com.iainteractive.blackberry; import net.rim.device.api.ui.UiApplication; public class FirstBlackBerryClass extends UiApplication { public static void main(String[] args) { FirstBlackBerryClass firstApplication  = new FirstBlackBerryClass(); firstApplication.enterEventDispatcher(); } public FirstBlackBerryClass(){ pushScreen(new FirstScreen()); } } //====================== package com.iainteractive.blackberry; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.RichTextField; final class FirstScreen extends MainScreen { FirstScreen(){ LabelField appTitle = new LabelField("HelloWorld Sample", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); this.setTitle(appTitle); RichTextField  greeting = new RichTextField("its running… great“); this.add(greeting); } } //====================== Test Your Application in the Simulator for testing application in device simulator, do the following steps, click on Run or the green shortcut icon on the toolbar. when your simulator starts, find and start your application from Downloads folder. When you run the application you should see its running… great message. To exit the simulator, just close its window. Author Profile Aasim Naseem Hey, Thanks for your interest. I’m a PMP, AWS Solutions Architect, and Scrum Master certified professional with 17+ years of hands-on experience leading projects, building teams, and helping organizations deliver software solutions better, faster, and smarter. Outside of work, I’ve got a deep curiosity for history — especially ancient civilizations like Egypt. I also enjoy reflecting on the everyday moments that shape how we live and work. This blog is my space to share insights, lessons, and thoughts from both my professional journey and personal interests. Thanks for reading — and I hope you will find something here that matches your interest. Latest entries PMP CertificationMay 23, 2025 | Read Count: 477Best PMP Study Resources for 2025 (Books, Courses, Tools & More) Agile & FrameworksMay 7, 2025 | Read Count: 445Agile vs Scrum: Finally Understanding the Difference Agile & FrameworksApril 25, 2025 | Read Count: 416When Not To Use Agile: 5 Signs You Need a Different Approach IslamApril 20, 2025 | Read Count: 445Quran on Peace and Kindness BlackBerry 3rd part of BlackBerry Application Development TutorialBlackBerry Application DevelopmentBlackBerry Application Development Tutorial (Part-2)BlackBerry Application Development Tutorial (Part-3)BlackBerry JDE Component PacksBlackBerry JDE plug-in for eclipseconfiguring eclipse with BlackBerryEclipse SDKFIRST APPLICATION FOR BLACKBERRYFirstBlackBerryClassJavaMainScreennet.rim.device.api.ui.container.MainScreennet.rim.device.api.ui.UiApplicationPUSH/POP of ScreensTest Your Application in the SimulatorUiApplicationWelcomeBlackBerry project
BlackBerry Widget SDK Released for BlackBerry August 8, 2009 | Read Count: 16,435April 29, 2025 Category: My Tutorials > BlackBerryResearch In Motion (RIM) has announced the BlackBerry Widget SDK to enable third-party application developers to build rich, integrated applications for BlackBerry smartphones using common web technologies. With the BlackBerry Widget SDK, developers can build web-based applications for BlackBerry smartphones with advanced features and functionality, a… Read More
BlackBerry RIM Launches BlackBerry Desktop Manager for Mac Users August 9, 2009 | Read Count: 16,418April 29, 2025 Category: My Tutorials > BlackBerryFinally, RIM launches BlackBerry Desktop Manager for Mac users. This new software makes it easy to sync data between Mac applications and BlackBerry smartphones. Waterloo, ON – Research In Motion (RIM) (NASDAQ: RIMM, TSX: RIM) has exciting news for Mac® users that want an easy and… Read More
BlackBerry BlackBerry Application Development Tutorial (Part-4) February 23, 2011 | Read Count: 14,440May 16, 2025 Category: My Tutorials > BlackBerryHello All, Hope you’re enjoying the world around you. Surprised?? I know; after a long time, I am here writing a tutorial on BlackBerry application development. It is a requested tutorial, asked for by some developers a few days back. So here it is: Author Profile… Read More
Hi, Nice article for beginners. By profession, I am also a software engineer. I have a query: I want to display LabelField at the bottom of screen in such a way that it automaticaly renders at the bottom of each screen of any size. Plz resolve this issue of mine. Waiting for reply…. Thanks, Anish Reply
Hello Ans, I have enjoyed this tutorial… I am now trying to expand this application to include three Numeric fields for user input, and buttons to calculate the total and the 3 fields, and to calculate the average of the 3 fields. I would appreciate any assistance you may wish to provide. Thanks and keep up the good work. Regards Alex Reply
Really brother ur teaching style is awesome..i m really impress… Pls dont stop n keep posting such helping stuffs… Reply
Thanks for the tutorial. Am new to Java and haven’t tested the program yet, but isn’t there a mistake under the section “Your First Program for Blackberry”? package com.iainteractive.blackberry; import net.rim.device.api.ui.UiApplication; public FirstBlackBerryClass extends UiApplication { public static void main(String[] args) { WelcomeBlackBerry firstApplication = new WelcomeBlackBerry(); firstApplication.enterEventDispatcher(); } Shouldn’t the class instantiation be: FirstBlackBerryClass firstApplication = new FirstBlackBerryClass(); It seems to be corrected in the full code for the program but it is misleading at the top. Reply
I like to share information that will I’ve built up with the 12 months to assist enhance group performance. Reply