BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   Searching address book contacts (http://www.blackberryforums.com/showthread.php?t=229993)

imran2k1 07-02-2010 02:46 AM

Searching address book contacts
 
Hi all,
i have to find Blackberry contacts form address book.
for that i am getting by using this code
Code:

ContactList contactList =
        (ContactList)PIM.getInstance().openPIMList

          (PIM.CONTACT_LIST, PIM.READ_ONLY);

now,i have to implement search functionality so for that i have been using loop to find particular contacts in contacts list therefore it has been taking more time(around 5 sec) if contacts are around more than 1000, but in default Blackberry address book search it is taking less time.
so i am looking for API which can give searched ContactList with name, if any one know kindly reply me.
for that i tried one method but i vein.
Code:

ContactList contactList =
        (ContactList)PIM.getInstance().openPIMList

          (PIM.CONTACT_LIST, PIM.READ_ONLY,"name");

i search on net too, but i did not get suitable thread.
looking for soon reply.

Thanks and Regards
Imran ali

imran2k1 07-02-2010 04:47 AM

Searching address book contacts
 
hello,
I got the solution myself.
I am replying here for others use.
Code:

ContactList contactList =
        (ContactList)PIM.getInstance().openPIMList

          (PIM.CONTACT_LIST, PIM.READ_ONLY);

 Enumeration allContacts = blackBerryContactList.items("your search Name");

it will return only contacts list which will contain your searching Name.
Thanks and regards
Imran ali

imran2k1 07-07-2010 04:00 AM

hi again,
Code:

Enumeration allContacts = blackBerryContactList.items("your search Name");
the above code has one problem,
it has been searching from all , like tiletle,company name, email etc form any field.
but i have to search in only First Name and Last Name.
for this i tried but i vein.
so if any one has solution please reply this thread.
Thanks
Imran ali


All times are GMT -5. The time now is 05:36 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.