Before you start
This series explores open source and Java™ technology for BlackBerry application development in the context of a mobile data-collection application. Part 1 provides an introduction to BlackBerry development with a quick introduction to the platform, a tour of the BlackBerry development tools, and construction of a complete data-collection application.
This tutorial focuses on BlackBerry application development using an example of a mobile content-management application. The example demonstrates a basic RSS reader leveraging the freely available BlackBerry development tools. Mobile development experience is helpful, but not required. Java programming skills are required for BlackBerry applications, but are not an explicit requirement for this tutorial. RSS feeds are the source of the data content used by the sample application. Familiarity with RSS is helpful, but not required if you just want an understanding of a mobile content-management application architecture.
Why be concerned about writing an RSS reader for BlackBerry? The BlackBerry, and all cell phones, are an integral part of life today. Our mobile devices have increasingly functional user interfaces (UIs) and increased technical capabilities in terms of data rates, storage capacity, and processor speed. But if there is no content to enjoy on these mobile powerhouses, the devices are of marginal use beyond the phone. We need content on our devices. Remember "The pen is mightier than the sword?" The written word matters. And today, the written word is digital — and mobile. The free flow of information and the freedom to subscribe to news of interest is the foundation of a free and open society. What better application of open source technology than an RSS reader to subscribe to free sources of information?
This tutorial uses the Java programming language to build a mobile news reader for the BlackBerry platform. There are commercial RSS readers for mobile devices, but it is not the objective of this tutorial to compete with the commercial applications. This tutorial shows how to build an open source application to help you build useful applications centered on content and its distribution. Learn about managing RSS feeds representing news items from a variety of sources. You can use this same paradigm in other applications, such as mobile fleet-management data, worker-dispatch data, or even implementing a mobile search engine.
Though it's a popular platform, third-party applications are still needed for the BlackBerry. There is no better way to bring those applications to fruition than to enable the open source community. Follow along as this tutorial lays the groundwork for an open source RSS reader application, which you can readily expand and retool for other useful purposes.
This tutorial provides a brief introduction to RSS, then dives into the requirements for a mobile RSS reader for BlackBerry. You can download the complete source code for the BlackBerry application.
This tutorial demonstrates how to use BlackBerry development tools to construct an open source RSS reader for BlackBerry. You will need the BlackBerry Java Development Environment (JDE) or equivalent to construct the application. This tutorial uses V4.0.2 of the JDE. The tutorial includes a few sample RSS feed links, but you can substitute your own links as desired.
In this tutorial, a mobile RSS reader application named IBMRss is constructed for the BlackBerry. As you go through, try to think beyond a news reader; the RSS data format can be leveraged for many other applications. You can download the full source code. Source-code snippets include:
- The application class that contains the entry point of the application.
- Class containing the UI elements, including menus and a ListField. Provides user interaction functions.
- Class that encapsulates the storage of data, including various access/helper routines.
- Method responsible for organizing the relationship between the stored data and the user interface. Used at startup and after the RSS feeds are refreshed.
- Method that presents the entries from a specific RSS feed when selected in the UI.
- Method that displays a specific RSS item's description and presents an option to view the Full Story.
- Class invoked by
showItemto display a specific RSS item.
- Class responsible for interacting with the BlackBerry's keyboard. It looks for the Enter and Esc keys.
- Method responsible for drawing the text for the ListField, which is used to display the RSS data. A single ListField is used for displaying a collection of RSS feeds and listing the items in a specific RSS feed.
- Class that extends the
DefaultHandlerclass to handle the parsing events generated by the SAX XML parser engine, which is used to parse the RSS feeds.
- Class responsible for fetching all of the RSS feeds when desired. Extends the
- Class containing some final members useful for communicating across threads and for uniquely identifying the application's data store.
- Class containing a single method of interest: split. This implements a simple tokenizer for processing data stored in our