Code road map

The source code for this application consists of 12 Java source files, one of which is the file, which you will recall is automatically generated based on the resources in the application. This section presents a quick introduction to each of these files. No code is explained yet; we just want to know a little bit about each file, and then it will be time to jump into the application, step-by-step. Table 12.1 lists the source files in the Android Field Service Application.

Table 12.1 The source files used to implement the Field Service Application

Source Filename


Activity provides splash screen functionality.

Activity provides management of username and server URL address.

Activity provides the main screen of the application.

Activity interacts with server to obtain updated list of jobs.

Activity provides access to list of jobs.

Activity provides detailed information on a specific job, such as an address lookup, or initiates the signature-capture process.

Activity collects electronic signature and interacts with the server to upload images and mark jobs as CLOSED.

Automatically generated source file representing identifiers in the resources.

Helper class encapsulating SharedPreferences.

Class that represents a job. Includes helpful methods used when passing JobEntry objects from one Activity to another.

Class representing the complete list of JobEntry objects. Includes methods for marshaling and unmarshaling to nonvolatile storage.

Class used for parsing XML document containing job data.

B drawabts

.til andiold.jpg

The application also relies on layout resources to define the visual aspect of the UI. In addition to the layout xml files, an image used by the Splash Activity is placed in the drawable subfolder of the res folder along with the stock Android icon image. This icon is used for the home application launch screen.

Figure 12.4 depicts the resources used in the application.

In an effort to make navigating the code as easy as possible, the Field Service Application resource files are presented in table 12.2. Note that each of these is clearly seen in figure 12.4, which is a screen shot from our project open in Eclipse.

Download at Boykma.Com

B drawabts

.til andiold.jpg

JÍ. fieldservke.xml ¿ managejobs.xml & refreshes.xml ¡xj showjob.xml ¡Xj showsetttngs.xml ¡ïj splash.xml

Figure 12.4 Resources used in the application

Table 12.2 Resource files used in the sample application




Image used in the Splash Activity.


Image used in the application launcher.


Layout for main application screen, FieldService Activity.


Layout for the list of jobs, ManageJobs Activity.


Layout for the screen shown when refreshing job list, RefreshJobs Activity.


Layout for job detail screen, ShowJob Activity.


Layout for configuration/settings screen, ShowSettings Activity.


Layout for splash screen, Splash Activity.


Strings file containing extracted strings. Ideally all text is contained in a strings file for ease of localization. This application's file contains only the application title.

An examination of the source files in this application tells us that we have more than one Activity in use. In order to enable navigation between one Activity and the next, our application must inform Android of the existence of these Activity classes. If you recall from chapter 1, this registration step is accomplished with the AndroidManifest.xml file.

0 0

Post a comment