Domanda

I am beginner of the Black berry development in that how to more customize the search result rather the use into my textbox.

I want to implement the dynamic search functionality in my Blackberry application where a user enters a character in textfield and matching content will be shown below in the list.

Now here I have achieved it but what I want is only the textfield should display and not the inbuilt listfield which comes with KeywordFilterField.

when the text changes the custom list gets populated automatically as i have coded in Fieldchanged() event but the inbuilt list is also shown which i don't want.enter image description here]![enter image description here

As you can see in the image I want the Text Field, I don't want the Default Listfield and I want the CustomListField(which is properly working with no issues).

È stato utile?

Soluzione

Got the Solution or a trick we can say.

First we have to implement the KeywordFilterField into the application note that we must not add it to our screen we are going to jus use the functionality of KeywordFilterfield.

Now we need to add the TextField into the screen now in the fieldChanged() event just set the keyword for KeywordFilterField. as follow.

   public void fieldChanged(Field field, int context) {
        // TODO Auto-generated method stub

        SearchTextBox temp=(SearchTextBox)field;
        _keywordFilterField.setKeyword(temp.getText());
    }

Now once we set the keyword the KeywordFilterField's change listener is fired so then we can write the code to display custom list field in that as follow

_keywordFilterField.setChangeListener(new FieldChangeListener() {

    public void fieldChanged(Field field, int context) {

        KeywordFilterField k=(KeywordFilterField)field;

        //Use k.getResultList(); method to fetch the resulting elements.

        //Write the code here for custom list to display.   
        }

});

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top