A few days ago to listen to friends talking about moving in that regard are talking about the issue on the PIM, which is a more cutting-edge technology. Suddenly think of it before the sun had an article on the website that is about PIM's, and today it is probably brief.
PIM means personal infomation management (personal information management), mainly for the user's important information, such as address book, reminder, schedule, etc.. PIM OP defines a series of API, provides access to these important data, methods and means. It is necessary to talk about what is OP, OP to mean that the optional package (optional package), he can not provide a full range of operating environments such as MIDP. He is also need for the expansion of MIDP devices. So he is not common, there are problems in transplantation.
Before using the PIM OP we must determine whether it is available, the method is very simple just check microedition.pim.version property value is not null, for example:
...
/ / Check that PIM Optional Package is available
String v = System.getProperty ("microedition.pim.version");
if (v! = null) (
/ / PIMOP available
) Else (
/ / PIMOP not available
)
...
You can not check in code pim package is available to determine the problem, because pim is and devices related. PIM defines three types of information, namely, Contact list, Event list, ToDo list, equipment, and must support all three types, but at least support one.
All of the API are javax.microedition.pim package inside, you have to PIM.getInstance () method to get the PIM category, then you can call openPIMList () method by the above list. For example, the following code:
...
PIM singleton = PIM.getInstance ();
ContactList cl = null;
try (
cl = (ContactList) singleton.openPIMList (PIM.CONTACT_LIST,
PIM.READ_ONLY);
/ / Use the contact list
)
catch (PIMException) (
/ / No contact list available!
)
catch (SecurityException) (
/ / The application is not allowed to access the list
)
...
It is worth mentioning that the SecurityException, for safety only trusted MIDlets can access the data. If not, will throw the exception, this is precisely meet the MIDP in Safe Mode. The data in the PIM list called PIM Item, you can PIM list as a container, the pim item as an entity. To access the item by the following code:
import java.microedition.pim .*;
import java.util .*;
ContactList list = ... / / a contact list
try (
Enumeration enum = list.items ();
while (enum.hasMoreElements ()) (
Contact contact = (Contact) enum.nextElement ();
/ / Do something with the contact
)
)
catch (PIMException e) (
/ / An error occurred
)
catch (SecurityException e) (
/ / Can't read this list
)
...
Available in the PIM item in the field is related with the devices, so when using a field called its isSupportedField necessary to determine what, PIM specification on the field as the basic data types are defined, For example, the TEL field in the Contact which is the String you pass getStri () method to get the birthday field is the long type by getDate () to get for example:
...
Contact contact = ...;
String tel = contact.getString (Contact.TEL, 0);
...
...
Contact contact = ...;
long bday = contact.getDate (Contact.BIRTHDAY, 0);
...
Which includes a number of fields in the contact, through the back of the index you can access them.
Recommended links:
Fast Roaming Illustrator 10 (1)
format Ts
Premier Network Monitoring
MMS can replace SMS?
Xvid ps3
Ts sony
M2ts To Mkv
Wizard Audio And Multimedia
Bargain OBSOLETE HP computers doubts
AMD quad-core processor "Barcelona" prices Announced
Animation with Fireworks
GOOD Graphic Viewers
Novell And Red Hat Open Source Giants Collision
Organization Process Definition
Job Interviews when the topic of 15 "Forbidden Zone"
Expert Vehicles - Screen Savers
Multinational Corporations, Where The Moral Bottom Line
No comments:
Post a Comment