.........................13 EDIA UPPORT DEVELOPMENT TOOLS ......................14 .........................14 EVELOPMENT OOLS .........................16 EVELOPER RAINING DEVELOPING FOR THE MOTOROLA T720 HANDSET ............17 ......................17 EVELOPING ROGRAMS Resources Available ......................17 Key Mapping Information.......................18 .........................21 REATING ROGRAMS Using MIDlet Stationery to Create a Project ................21 Using the MIDlet Wizard to Create a Project .................24 Preverifying a MIDlet ......................29...
Page 3
Table of Contents CODING EXAMPLE ........................40 ........................40 UTTON VERVIEW LWT B ..................40 HARACTERISTICS OF UTTONS .....................44 OUND UTTON LASS ’ ..................50 ODIFY A UTTON HARACTERISTICS ’ ....................52 ODIFY A UTTON OCATION INDEX............................55...
Introduction Welcome to the Motorola T720 Handset Developer’s Guide. This manual contains all the information you need to get started developing software that operates on the Motorola T720 handset. The Motorola T720 handset information covers the following areas: • Hardware specifications like displays, processors, memory, and more •...
Developing for the Motorola T720 Handset –provides the information you need in order to create, debug, download, and package programs • Coding Example–learn how to customize the LWT Button class on the Motorola T720 in this extended code example. Glossary...
The following references provide information related to developing software for wireless devices in general. Organization 3GPP www.3gpp.org Brew Development www.qualcomm.com/brew Infrared Data Association www.irda.org JPEG Organization www.jpeg.org Motorola Developer Program www.motocoder.com Open Mobile Alliance www.openmobilealliance.org Qualcomm www.qualcomm.com Sun Microsystems wireless.java.sun.com WAP Forum www.wapforum.org World Wide Web Consortium...
This gives the Motorola T720 a theoretical download rate of 54 Kbps and a theoretical upload rate of 13.4 Kbps. These rates will vary according to the network operator's channel allocation...
Maximum Colors 4096 The resolution of the interior color screen on the Motorola T720 is 120 by 160 pixels. The interior color screen displays nine lines of text, plus one line of color icons. A “zoom mode” has the screen present 7 lines of enlarged text for easy reading. The Motorola T720 has a second, 96- by 32-pixel black-and-white screen on the outer case.
Motorola T720 appear at a much higher quality than on devices whose display hardware limits the palette to 256 colors. The Motorola T720 generates a 12-bit color by taking a 24-bit RGB color value and truncating the four least significant bits in the byte that represents each color component.
Software Environment This chapter describes the environment of the Motorola T720 handset. Use it to understand the operating system and software environment in which your software will operate. Java™ Support This device supports the following Java™ technologies and their respective APIs: •...
WAP specification–WAP 1.2.1 • WML 1.3, xHTML, WTLS Class 2 For information on WAP, visit: www.wapforum.org Display Language Support The following languages bundles are supported by the Motorola T720 handset: Bundle ID Language Bundle 0001 US English 0002 UK English 0003 US English, French Canadian, Spanish Col.
Page 12
Bundle ID Language Bundle 0005 UK English, French, German, Dutch 0006 0007 0008 000A UK English, Spanish, Portuguese, Greek 000B UK English, Norwegian, Danish, Swedish 000C UK English, Swedish, Finnish, Estonian 000D UK English, Lithuanian, Latvian, Russian 000E UK English, Polish, Czech, Slovak 000F UK English, Hungarian, Turkish, Bulgarian 0010...
Chinese as a supported language, not the subgroups of Traditional or Simplified Chinese. The program itself must then determine which version of Chinese to use. Media Support See the Creating Media for the Motorola T720 Handset manual for information on supported media types, which include: •...
Motorola SDK for J2ME™ The Motorola Software Development Kit (SDK) for the J2ME platform is the tool used for developing and testing programs written in the Java programming language. The SDK includes applications that make it easy to launch MIDlets (J2ME programs) using the Motorola J2ME device emulator.
Page 15
Lightweight Windowing Toolkit (LWT) The Lightweight Windowing Toolkit (LWT) is a J2ME™ Licensee Open Class (LOC) designed by Motorola to enhance the capabilities of the Mobile Information Device Profile (MIDP). It defines new J2ME classes to implement Buttons, Checkboxes, Sliders, and other user interface widgets.
Online, instructor led courses are available at the Motorola Developer Learning Center for members of the Motorola Developer Program. These courses provide a faster and easier way for you to get up to speed in developing applications that operate on Motorola Java technology enabled devices.
Developing Programs This section provides the basic resources available and key mapping information needed to develop applications for the Motorola T720 handset. Resources Available This section provides information on the availability of resources for the Motorola T720 handset. Internal Display Resolution...
Page 18
Java at any given time. Zoom In and Zoom Out Modes The Motorola T720 supports zoom in and zoom out modes on the display. When zoom in mode is selected, the display area is enlarged, reducing the number of visible pixels on the display.
Developing for the Motorola T720 Handset Key Mapping Information The key map information for the Motorola T720 handset is as follows: Key Number (KN) Key Code (KC) Game Action (GA) # (pound) * (asterisk) GAME_A GAME_B GAME_C GAME_D Down Arrow...
Developing for the Motorola T720 Handset Creating Programs This section explains how to use the CodeWarrior™ IDE to create MIDlets. A MIDlet is a Java™ application that conforms to two specifications defined by Sun® Microsystems: • the Connected, Limited Device Configuration (CLDC) and •...
Page 22
Figure 3. New window Select Java J2ME Stationery. Name the project. Type a name for the project in the text field labeled Project Name. If you want your project to be recognized by all versions of CodeWarrior tools on all host platforms, the filename extension must be .mcp.
Page 23
Developing for the Motorola T720 Handset Check the Create Folder check box to indicate that you want to create a new folder that will contain all of the project files. The new folder has the same name as the project file without the file extension.
Figure 6. Project Window displaying project created from J2ME Stationery The CodeWarrior project manager also creates a directory named ProjectName Data, where ProjectName is the name of your project. The CodeWarrior IDE uses this directory to store internal data. Do not modify or move any files in this directory. A project that is created from stationery contains example source files, and other files that provide you with a starting point for your project.
Page 25
Developing for the Motorola T720 Handset Figure 7. New Window Select MIDP Midlet Wizard. Name the project. Type a name for the project in the text field labeled Project Name. If you want your project to be recognized by all versions of CodeWarrior tools on all host platforms, the filename extension must be .mcp.
Page 26
The IDE saves the location and returns to the New window. Click the OK button. The IDE displays the New MIDP MIDlet: Page 1 of 3 window (Figure 9). MIDlet Wizard - Page 1 of 3 The first page of the wizard (Figure 9) lets you define basic properties of the MIDlet, such as the class and package name.
Page 27
Developing for the Motorola T720 Handset MIDlet Wizard - Page 2 of 3 Page 2 of 3 (Figure 10) of the wizard lets you specify information about the form class for the MIDlet. Fill in the appropriate fields and click Next button to show the next page of the wizard.
Page 28
MIDlet Wizard - Page 3 of 3 This page of the wizard (Figure 11) contains information that the IDE can insert into each of the source code files it generates. Fill in the appropriate fields and click Finish button to show the Summary page of the wizard.
Developing for the Motorola T720 Handset MIDlet Wizard - Summary To complete the wizard and generate the project just review the attributes that you have specified, then click the Generate button. The CodeWarrior IDE creates the project files and a project folder for a new MIDlet project. The CodeWarrior IDE displays a new Project window (Figure 4.11).
Access the Java Output settings panel (Figure 13). Select Java Output in the Target Settings Panels list on the left side of the window. The IDE displays the Java Output settings panel. Figure 13. Java Output Settings Panel with Preverification Enabled Check the Preverify check box.
Debugging Programs CodeWarrior Wireless Studio supports the low-level debugging of Java projects, however, direct on-device debugging is not supported. Instead, you must use the Motorola T720 Simulator available in the Motorola SDK for J2ME to debug your Java programs. For information on the CodeWarrior Debugger, see the CodeWarrior IDE User Guide. For information on debugging Java projects, see the CodeWarrior Wireless Studio manual.
• Simulator Config. File: Motorola T720 Figure 15. Java Target settings panel showing debug setting for Motorola T720 Debugging a MIDlet To debug a MIDlet using the CodeWarrior IDE: Make sure the MIDlet project is open in the Project window.
Developing for the Motorola T720 Handset Downloading Programs This section explains how to download a MIDlet program to the Motorola T720 handset. Serial Downloading By default, the serial downloading of programs is disabled on Motorola T720 handsets. It is recommended that you use OTA instead to load programs on the device for testing.
Motorola T720 handset. Installation Checklist Here is a checklist of items to review before attempting to download a program to the Motorola T720 handset for testing. Following this checklist will ensure that you don’t waste testing time. Application checklist: •...
Page 35
END soft key. Removing Applications Use the standard menu commands on the Motorola T720 to remove a program once you are finished using it.
Packaging Programs When developing applications, there are two situations to be aware of when packaging your applications for loading on the device. • Accessing external libraries or resources–in this situation, make sure that all the necessary libraries and resources are placed in the JAR file so that the application has access to them on the device.
Although image files take up the correct amount on space on the “real” phone, you will encounter other problems there. On the real Motorola T720 phone an installed MIDlet requests twice as much memory as it needs so you might run into more problems.
Page 38
Title OTA installation failed on Motorola T720. While downloading an application to the Motorola T720, an OTA failed Problem message comes up:"File corrupt". Does this mean the JAD/manifest files are incorrect, class files are not correctly preverified…etc.? Solution In the event you experience problems, check the following: 1.
Page 39
Developing for the Motorola T720 Handset Title Determining the font size used in the Motorola T720 in various regions. Different regions use different font sizes in the device. A program Problem needs to consider the font size when it comes to drawing to the screen to avoid display errors.
MOTOCODER web site: www.motorola.com/wireless/developers. Characteristics of LWT Buttons One of the most valuable capabilities of the Motorola LWT is that it provides a toolbox of ready-made user interface (UI) components. You use these components to implement the interface to your mobile application.
Page 41
Coding Example This lesson demonstrates the capabilities of one LWT UI component, the Button class. The Button class provides a simple and effective way to add interactive buttons to your application’s interface. LWT buttons have the following features: • They can have different, descriptive labels. Within limits, a button automatically resizes itself to accommodate the text string that makes up the label.
Page 42
UI elements. Step 3: Observe the button’s behavior Click on the Motorola T720’s navigation button or use the keyboard’s arrow keys to navigate down the screen. The first click on the navigation button’s down arrow causes the small button at the top of the screen to display a small border (Figure 17). This border indicates that the button has focus, or focus ownership.
Page 43
Coding Example Press on the phone simulator’s End key (which represents the LWT’s Enter key) and hold it down. Watch what happens to the button (Figure 18). Release the key, and the button reverts to its normal state. Figure 18. The LWT button when the Enter key (the End button) is pressed.
Buttons.java in the Project window to open the file in the editor. import java.io.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import com.motorola.lwt.*; // The RoundButton class. Draws a round LWT button. // Inherits the rest of its capabilities (such as // key events) from the Button class.
Page 45
Coding Example public class RoundButton extends Button { String label; // The Button's text * Constructs a RoundButton with no label. public RoundButton() { this(""); * Constructs a RoundButton with the specified label. * @param label the label of the button public RoundButton(String label) { int x, y;...
Page 46
* gets the label * @see setLabel public String getLabel() { return label; * sets the label * @see getLabel public void setLabel(String label) { this.label = label; repaint(); These methods, getLabel() and setLabel(), fetch the string that represents the RoundButton’s label or sets it, respectively. The next method, paint(), contains the code that draws a round button: * paints the RoundButton public void paint(Graphics g) {...
Page 47
Coding Example One thing to note is that we reduce the drawing rectangle’s size by five pixels. This is so that the button and its focus border (which must be slightly larger than the button) can be drawn safely within the rectangle that comprises the actual component. If you draw outside of the component’s rectangle, a portion of the image is clipped.
Page 48
Finally, the code draws the button’s label. It first sets the color that’s used to draw the string, based upon the buttons’s state. That is, for the normal state, the text is set to black, otherwise, it is set to white to represent the pressed state. The getFont() method fetches the string’s typeface information.
Page 49
Coding Example LWT manages this for you, and as the RoundButton code shows, you merely query these state values as you paint the component. The LWT will issue a repaint request every time a component’s state changes. Because of how getPreferredWidth() and getPreferredHeight() are implemented, the button automatically sizes itself to accommodate the label’s width.
Modify a Button’s Characteristics Let’s examine ButtonDemo’s constructor in more detail to see how LWT buttons are made, and how their visibility and screen location can be changed. Scroll through the Buttons.java file with the editor to find: // The constructor for our screen public ButtonScreen() { // First button b1 = new Button("Button");...
Page 51
Coding Example } // end constructor As the code shows, using an LWT button is straightforward. You use the new constructor and then the add() method to add the button to a LWT ComponentScreen. (The instance of a ComponentScreen is made in the class DemoScreen.) Making a RoundButton is no different: you use its new constructor and add it to the ComponentScreen.
Figure 21. The screen after the second button was made invisible and the fourth button is disabled. Step 4: Watch the change of focus ownership. Use the navigation button to traverse the focus among the enabled buttons. You’ll see that only two of the buttons receive focus ownership: the first button b1, and the second round button, b5.
Page 53
Coding Example Step 1: Change a button’s offset scheme Locate the code for the fifth button, b5, in the ButtonScreen’s constructor. Uncomment the statement: // b5.setLeftEdge(Component.PREVIOUS_COMPONENT_RIGHT, 0); What this statement does is offsets b5’s left edge to the right edge of the previous component, which is the round button b4.
Page 54
This statement has the b5 button’s top edge offset from the top edge of the preceding component, not from its bottom. The second argument can supply a pixel value to add to this offset. Since it’s zero for this example, the b5 button’s top will be aligned to the top of the button b4.
Page 57
MOTOROLA and the Stylized M Logo are registered in the U.S. Patent & Trademark Office. All other product or service names are the property of their respective owners. Java and all other Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.