Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
javapowertool
Posts: 7
Registered: ‎02-27-2009
My Device: Bold

Keyword Search problem in KeywordFilterField

Hi Guys ,

 

I am trying build an application similar to BB Address book with search of contact son the basis of first name and Last name, for this i am using the KeywordFilterField.

 

In my implementation of KeywordFilterField  the Corresponding returns two keywords for a entry(contact) ,firstName and last name. The search works perfectly for normal inputs.

 

Now here is the problem

if there are two contacts say Adam Sandler , Adam Santiago and we entered Adam San in the search list text box the search result shows both the entries which is CORRECT(Adam San is prefix of both Adam Sandler and Adam Santiago ) , but if entered further  Adam Sandler still  it shows the two records.

 

I tested same thing with BB Address book  and it shows  correctly One record result with Adam Sandler.

 

I guess BB Address book uses the same UI Component with some customization (An example of this can be found in the Address Book application.

 

Following is the implementation of my keyword provider:-

 

 

 

class ContactKeywordProvider implements KeywordProvider{

public String[] getKeywords(Object element) {

if (!(element instanceof Contact)) {
throw new IllegalArgumentException();
}

Contact contact = (Contact) element;
String[] keywords = null;

String firstName = contact.getFirstName();
String lastName = contact.getLastName();


keywords = new String[2];
keywords[0] = firstName;

keywords[1] = lastName;

return keywords;
}
}

 

I want to know what should  be the implementation of KeywordProvider to get behavior similar to BB Address book. 

Guys Pls help me in this....

 

 

Please use plain text.