10-21-2008 04:11 AM
Sorry if I missed something so trivial that could invalidate this question, but - well I missed it
My app constantly looks for the same Contact in the ContactList.
Is there any better way to find a contact -> O(1) than to go thorugh the whole list -> O(n) ?
Some kind of index? or an advanced search option I oversaw ?
Usually I add a contact and after some time I need to access it once again.
Sometimes it's in the same application run, sometimes it's not
Solved! Go to Solution.
10-21-2008 05:52 AM
I found more information...
That was a part of something I need.
I am wondering.... I am also involved in developing for Symbian. It has an option to find a contact by phone number using NATIVE serach. By native search I mean the same one their phone uses when matching incoming call phone number with the address book items.
Now isn't that convenient
That's exactly what I would need.
The aforementioned thread explained a need for searching by phone number and a way around the limitation not having one.
I guess this thread's question should now be changed to:
Is there a way to find a contact by phone number with O(f(n)) < O(n) or are we destined to use the 'second address book' workaround ?
P.S. btw how many of the last phone number digits is it 'safe' to match to be certain about the match (my guess 7)?
10-21-2008 10:31 AM
The method outlined in the thread you quote is the recommended approach.
Regarding the matching of the last phone number, you could perform the search based on the last 4 digits and then perform a more detail string match of the results returned within your application.
10-21-2008 10:46 AM
Is there an addressbookchangelistener or something to allow your local index to stay current?
If so, that is essentially the custom database others have been looking for. That is, you go through your
data source ( contact list, xml file, whatever) and create a persistent index of some type suited to your
needs. Some of the RIM classes I cited earlier should make good bases from which to do this in java.
I've been generally impressed with the speed of even my 7130 and thought most stuff was IO limited.
I would have thought that brute force sequential searches would be acceptable for many address books.
10-21-2008 12:59 PM