O fromBundle

public static JobEntry fromBundle (Bundle b) { <1-JobEntry je = new JobEntry(); j e.set_j obid(b.getString("j obid") ) ; j e.set_status(b.getString("status") ) ; // assignments omitted for brevity j e.set_producturl(b.getString("producturl")); j e.set_comments(b.getString("comments")); return j e;

method

This application relies heavily on the Bundle class O for moving data from one Activity to another. This will be explained in more detail later in this chapter. A String member Q exists for each element in the job such as jobid, customer, and so on. The toString() method © is rather important as it is used when displaying jobs in the ManageJobs Activity, discussed later in the chapter. The toXML-String() method Q generates an XML representation of this JobEntry, complying with the job element defined in the previously presented DTD. The toBundle() method Q takes the data members of the JobEntry class and packages them into a Bundle. This Bundle is then able to be passed between activities, carrying with it the required data elements. The fromBundle() static method G returns a JobEntry when provided with a Bundle. The toBundle() and fromBundle() work together to assist in the passing of JobEntry objects (at least the data portion thereof) between activities. Note that this is one of many ways in which to move data throughout an application. Another method would be to have a globally accessible class instance to store data, for example.

Now that you understand the JobEntry class, we need to look at the JobList class, which is a class used to manage a collection of JobEntry objects. JOBLIST

When interacting with the server or presenting the available jobs to manage on the Android device, the Field Service Application works with an instance of the JobList class. This class, like the JobEntry class, has both data members and helpful methods. The JobList class contains a typed List data member, which is implemented using a Vector. This is the only data member of this class, as shown in listing 12.11. The methods of interest are described in the listing.

0 0

Post a comment