Java Reference
In-Depth Information
UPDATE_ERROR : Indicates an exception where the update could not continue
UNSUPPORTED_VERSION : If the data is not supported by the version of the PIM
database
Let's look in more detail at these and the other operations you can perform using the
PIM package.
Ensuring the PIM Package Is Available
Before you use the PIM package, you should ensure that it's actually available. You do this
using System.getProperty , like this:
String currentVersion = System.getProperty("microedition.pim.version");
This returns the version number of the PIM package, so you can (and should!) check
to see if your code is version-compatible with the PIM package that's on the device you're
targeting. The call returns null if no PIM package is available.
Once you've ensured that the PIM package is available, you must obtain an instance
of the PIM singleton that provides access to all of the methods for opening and managing
PIMList s. You do this using the PIM.getInstance method.
Opening a PIM Database
You don't open a PIM database in the same way you would a file, although similar things
are probably happening under the hood. Instead, you obtain a PIMList instance from the
PIM class using PIM.getInstance().openPIMList . This interface takes two arguments: the
type of the list to return ( PIM.CONTACT_LIST , PIM.EVENT_LIST , or PIM.TODO_LIST ) and an
access mode indicating whether the list should be returned as read-only ( PIM.READ_ONLY ),
write-only ( PIM.WRITE_ONLY ), or read-write ( PIM.READ_WRITE ).
Some devices have the capability of keeping more than one PIM list of a particular
type. Don't confuse this with categories; categories indicate organization within a PIM
database, while this feature permits wholly separate lists. You can obtain a list of PIM
databases by type by invoking PIM.getInstance().listPIMLists , passing one of the PIM
list types ( PIM.CONTACT_LIST , PIM.EVENT_LIST , or PIM.TODO_LIST ). In return, you get an array
of String instances; each is a name you can pass as an optional third argument to
PIM.getInstance().openPIMList .
 
Search WWH ::




Custom Search