|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nokia.mid.pim.PIMUtils
public class PIMUtils
This class includes some common methods as extentions of PIM.
Constructor Summary | |
---|---|
PIMUtils()
|
Method Summary | |
---|---|
static int |
compareContactName(java.lang.String name1,
java.lang.String name2)
Compare contact name in phonebook. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PIMUtils()
Method Detail |
---|
public static int compareContactName(java.lang.String name1, java.lang.String name2)
Compare contact name in phonebook.
openPIMList() returned the sorted contacts with the same order as native phonebook. when language is changed or contacts sortby setting is changed, app should recall openPIMList() to keep the same order contacts as native phonebook.
When contact change happened, app can insert/update the changed contact in cached list with the compare interface.
To keep the same order as native phonebook, Contact.FORMATTED_NAME is preferred.
Contact c1;//Maybe got from PIMList.items()
Contact c2;//Maybe got from ContactChange
String fn1;
String fn2;
if (c1.countValues(Contact.FORMATTED_NAME) > 0) {
fn1 = c1.getString(Contact.FORMATTED_NAME, 0);
}
if (c2.countValues(Contact.FORMATTED_NAME) > 0) {
fn2 = c2.getString(Contact.FORMATTED_NAME, 0);
}
int result = PIMUtils.compareContactName(fn1, fn2);
if (result == 0) {
//fn1 == fn2
} else if (result == -1) {
//fn1 < fn2
} else if (result == 1) {
//fn1 > fn2
}
name1
- one name to comparename2
- the other name to compare
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |