Home > Articles > Networking > Wireless/High Speed/Optical

Developing a Newsreader in Java

  • Print
  • + Share This
Are you a news junkie? Need headlines on the fly? Mobile phones offer fascinating opportunities to create applications for mobile workers. In this article, Mikko Kontio gives you helpful source code and tells you how to develop a newsreader for Java-enabled phones.
Like this article? We recommend

Like this article? We recommend

Accessing news is one of the most important uses of mobile applications. News headlines and quick news give us a lot of important information, and we can (almost) always find another source for information when something interesting or important happens. In this article, we'll design and implement a newsreader with mobile Java to run in mobile phones that support MIDP 1.0.

Architecture of the System

The network architecture of the application (see Figure 1) is very simple; it consists of the mobile client and a website offering news in XML format. The news provider is a free news service provider called XML News.net, which offers news related to XML. There are numerous other news services around the globe that has their news or headlines in XML format. So it is easy to modify this application to suit your own provider's news feed.

Figure 1Figure 1 The network architecture of the application.

The first screen of the application displays a list of headlines. These headlines can be long texts, and the user can see only the few first words in the list. When the user chooses the headline, another display shows the whole headline.

The class diagram of the application is shown in Figure 2. The MIDP classes are in italic, the new classes are in bold, and the third-party XML parser is both italic and underlined. The class diagram shows the associations between classes, and it also shows which of the MIDP's classes we have used.

Figure 2Figure 2 The Class diagram of the application.

The NewsReaderMIDlet is the main class of the application. It creates the other classes and acts as command listener for all the actions and command. For the http connection, we used a wrapper class, which takes care of the details in the http connection and also fills the menu. The details are shown with the HeadLineDetail class, which is inherited from Form.

  • + Share This
  • 🔖 Save To Your Account