Using the Java Wireless Toolkit
- Understanding the Java WTK
- The RTTTLEx Application
- Creating a List of Ring Tones
- Understanding the MIDP List Class
- Working with the Display Object and the Displayable Interface
- Configuring Commands
- Registering CommandListeners
- The Methods of a MIDlet
- Selecting a Tune
- The MIDP Canvas Object
- Playing a Tune
The Java Wireless Toolkit (WTK) is a programming environment you can use to create Java applications that run on Java-enabled cell phones and PDAs. In an earlier article, "The World of Mobile Ring Tones," I showed you how to use the WTK to play a custom ring tone. In this article, I'll go into the WTK in more depth, covering the following topics:
Basics of the WTK framework
How to create interactive cell phone menus
MIDP Command objects
You don't need to know anything about the Java Wireless Toolkit to make sense of this article, but I do expect that you know fundamental Java, understand the rules of Java interface implementation, and have some knowledge of Listener classes.
You can download the Java Wireless Toolkit here.
Understanding the Java WTK
The WTK emulates cell phones and other mobile devices through the Mobile Interface Device Profile (MIDP) standard. The MIDP standard is supported by most popular cell phone manufacturers, such as Nokia, Motorola, and Blackberry. MIDP applications are called MIDlets. The MIDP abstracts the various physical features of the mobile device into a set of Java classes. You manipulate these MIDP classes to present data and graphics on the cell phone's screen and to allow users to interact with that onscreen data. The WTK ships with extensive documentation describing the MIDP specification and how to create MIDP applications. In addition, the WTK provides a number of demo applications and tutorials that show in the ins and outs of MIDP programming. In fact, most of the application that I created for this article is adapted from code in the AudioDemo app that comes with the WTK.
Probably the most important thing to remember about the Java Wireless Toolkit is that it's a programming framework. The constituent classes of the WTK handle many of the low-level aspects of programming for mobile devices. For example, in the application that I created for this article, command key assignment, most command processing, and screen painting are handled automatically. Of course, you can override behaviors in order to customize your application. But once you get the hang of the WTK, you can write a few lines of code to get a whole lot of functionality.