RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Become a Cross-platform Wireless UI Expert : Page 7

Writing a user interface for your app that runs on all of today's mobile devices can be a huge challenge. Among the things you need to consider: diverse appearances, functionality, memory, screen real estate, and persistent storage availability. This article describes the many pitfalls of developing a user interface for diverse devices and tells you how to devise a plan that will save you time and headaches.

Figure 9: The search screen while a search is performed.

User Input
To search for a book, the application uses a TextField into which you enter a search term. Navigation is simple; on the search screen the only commands available are to exit or to begin the search.

After beginning a search users can cancel the current search or exit the application. Canceling the search returns the user to the search screen.

Figure 10: A single search result is returned.

If the search finds an exact match for the query string then the application displays the detail information screen for that one result immediately, saving users the trouble of clicking the item.

When a search returns more than one result, the application displays the first five results as items in an implicit List. The user can drill down into a result by selecting it, exit the application, conduct a new search, or move to the next or previous set of results.

Finally, when users are on an information screen they see an exit button, a new search button, or, if there are more results, a back button.

Figure 11: Multiple search results are returned and a scroll button is added.

With the design reasonably complete, you can start coding UI functionality; the backend development can proceed separately. Start by creating self-contained classes derived from Form. For example, the SearchForm displays a TextField for data entry and prepares commands and titles as appropriate for this form.

Create instances of Commands that you've identified as shareable. Make them available in a centralized location. This centralized location will also hold more general Commands such as Exit or New Search. Although you can create a separate class, the sample application handles centralized behavior in the MIDlet's main class.

In general, forms that contains more than three Commands are potentially confusing to users. The multiple result list screen in this project is an example, of keeping a complicated set of commands down to three (see