Online Test Banks
Score higher
See Online Test Banks
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Implementing Basic Java Application Classes for a BlackBerry App

Part of the BlackBerry Application Development For Dummies Cheat Sheet

Your BlackBerry application starts off from a blank slate. The Java Development Environment (JDE) creates an empty workspace, and you will add a project and Java source files. You need to implement subclasses of some basic BlackBerry library classes to create a full-fledged application:

  • net.rim.device.api.ui.UiApplication: This is your application class, which is the overseer of your BlackBerry application's contents. You'll usually implement a main method within this class as well.

  • net.rim.device.api.ui.container.MainScreen: Your BlackBerry application shows several screens of information to users. You subclass MainScreen to provide a basic display for them to see.

  • net.rim.device.api.ui.MenuItem: Users expect to perform some navigation by using menus, and you support their expectations by creating subclasses of MenuItem to provide menu-selection functionality. Your BlackBerry application can do this inline by creating a new MenuItem object and adding specific methods to the object during its creation. Note that if you're making the same MenuItem over and over, you should seriously think about creating a real subclass for it.

  • net.rim.device.api.ui.Manager: This class is useful when you want to lay out the components of a MainScreen subclass in a specific, controlled formation. MainScreen comes with a particular Manager subclass — VerticalFieldManager — as default. But it's pretty vanilla-boring, so you might want to think about creating your own.

  • net.rim.device.api.system.Persistable: Your BlackBerry application will very likely be storing users' data, and this is the interface that you need to implement in your classes that store the data in a PersistentStore.

  • java.lang.Thread, Runnable: You have to subclass these in certain situations where your BlackBerry application performs some long-duration operation, such as trading information with a network service or communicating via a Bluetooth peripheral. In addition, certain classes you provide to the BlackBerry OS, such as MenuItem, incorporate threaded behavior as part of their operation. MenuItem requires you to implement a run() method, which is launched as a separate Thread when the user selects your MenuItem.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

BlackBerry Application Development For Dummies Cheat Sheet


Inside Sweepstakes

Win $500. Easy.