Implementing the UI elements

The package bcexchanger.ui contains the classes which implement the UI of the application. The UI is implemented as a state machine, where each screen is a state. The package ui contains the abstract class Screen and classes AddressBookScreen, AlertMessage, MainScreen, ProgressScreen, and ServiceListScreen.

Note: Since this package contains only UI related classes, the code is not described here. To see the code, download the example from Forum Nokia.

AddressBookScreen class

This class is responsible for displaying the content of the phone book and allowing user to choose his or her own business card. The user can either choose the contact or exit the application. The class extends the Screen (bcexchanger.ui) class.

AlertMessage class

This class represents a screen displaying an alert message. The class extends the Screen (bcexchanger.ui) class.

MainScreen class

This is the idle state screen. This class implements the main screen of the application. Using this screen the user can initiate an exchange of business cards, change own business card, and exit the application. The class is extends the Screen (bcexchanger.ui) class.

ProgressScreen class

This class implements the screen, which indicates that some operation is in progress. For example, when inquiry, service discovery, or business card sending and receiving is running, this screen is displayed. With this screen the user can cancel the process. The class is extends the Screen (bcexchanger.ui) class.

Screen class

This class is an abstract base class for all the UI screens in this application. This class implements the CommandListner interface.

ServiceListScreen class

This class is used to display the list of devices which provide services (in case there is more than one "Business Card Exchanger Service" in the vicinity) and to provide the means for choosing only one service or canceling the process.