com.nokia.mid.pim
Class PIMUtils

java.lang.Object
  extended by com.nokia.mid.pim.PIMUtils

public class PIMUtils
extends java.lang.Object

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

PIMUtils

public PIMUtils()
Method Detail

compareContactName

public static int compareContactName(java.lang.String name1,
                                     java.lang.String name2)

Compare contact name in phonebook.

Background:

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.

Requirement:

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.

Example Code:

       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
       }
 

Parameters:
name1 - one name to compare
name2 - the other name to compare
Returns:
0 in case of name1 equals name2. -1 in case of name1 is less than name2. +1 in case of name1 is greater than name2.


Copyright © 2012 Nokia Corporation. All rights reserved.

Nokia is registered trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Oracle Corporation. Other product and company names mentioned herein may be trademarks or trade names of their respective owners. This document is confidential information of Nokia Corporation.

Disclaimer
The information in this document is provided "as is," with no warranties whatsoever, including any warranty of merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specification, or sample. Furthermore, information provided in this document is preliminary, and may be changed substantially prior to final release.

Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to this document and implementation of any information presented in this document.

Nokia Corporation retains the right to make changes to this document at any time, without notice.

License
Subject to above disclaimer, a license is hereby granted to use this documentation solely under existing Limited License Agreement and non-disclosure agreement between the companies for the agreed application development for Series 40 Nokia phones. No other licenses e.g. to any intellectual property rights are granted herein. Any use of the screen shots of this documentation, including any icons thereof, is subject to Nokia's prior written approval.