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
Developer
Posts: 121
Registered: ‎11-19-2008
My Device: Not Specified

How to delete from KeywordFilterField?

I am having difficulty deleting an item from a KeywordFilterField. I started with the sample code provided by RIM http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_search_field_508886_11.jsp

 

When the KeywordFilterField is in search mode, that is when there is something entered in the search field, calling delete(index) on the selected item produces strange results and doesn't delete the currently selected item but rather deletes the last item in the list of filtered results.

 

        Object selected = filterField.getSelectedElement();
        if(selected != null){
            int selectedIndex = filterField.getSelectedIndex();
            filterField.delete(selectedIndex);
        }

Does anyone know what is the correct way to delete an item in this case?