07-25-2010 07:27 AM - edited 07-25-2010 02:59 PM
I'm trying to build something similar to BB native Contacts app using KeywordFilterField where one can edit/add/delete contacts from a list. When finished the list would be saved.
I have a Contacts class which has a list (vector) of contacts (instances of Contact class). I feed that list (vector) to a SortedReadableList and use this object to construct a KeywordFilterField containing names of contacts.
My Contact class implements Persistable which allows me to persist the vector in my Contacts class.
What's the best way to sync between my Contacts vector and the data in KeywordFilterField?
i.e if i add or remove an element in KeywordFilterField list, i have to do the same in my Contacts vector but sometimes the indexes of the elements are different in my vector and in my KeywordFilterField list since KeywordFilterField sorts the list after every operation.
I suppose i could keep the vector sorted or work with objects instead of indexes but i have a feeling that i'm doing something terribly wrong.
Any help would be greatly appreciated.