BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 03-16-2010, 04:33 AM   #1 (permalink)
New Member
Join Date: Feb 2010
Model: 9500
Carrier: NA
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default facing problem using KeywordFilterField example

Please Login to Remove!

Hello All,

I am trying to make a searchable list where each entry can include multiple lines and sometimes an image. I have done this by using ListFieldCallback.

Now I am facing the problem in sorting the list. My code is as follows

MyListFieldCallback listCallback = new MyListFieldCallback();


_keywordFilterField.setSourceList(_countryList, _countryList);

The code of the MyListFieldCallback is the following:

public class MyListFieldCallback implements ListFieldCallback {
Vector _listData = new Vector();
public Vector get_listData() {
return _listData;

public void set_listData( Vector data ) {
_listData = data;

public void drawListRow( ListField listField, Graphics graphics, int index, int y, int width ) {
int defalutColor = graphics.getColor();
Object currentRow = this.get(listField, index);
if ( null != currentRow ) {
// Between each row a line is drawn
graphics.drawRect(0, y, width, listField.getHeight());
graphics.drawText(((Country)currentRow).get_countr yName(), 0, y, Graphics.ELLIPSIS, Display.getWidth()/2);
graphics.drawText(((Country)currentRow).getCapital City(), Display.getWidth()/2, y, Graphics.ELLIPSIS, Display.getWidth()/2);

public Object get( ListField listField, int index ) {
return _listData.elementAt(index);


public int getPreferredWidth( ListField listField ) {
// TODO Auto-generated method stub
return 0;

public int indexOfList( ListField listField, String prefix, int start ) {
// TODO Auto-generated method stub
return 0;


I think selection i.e the list used by drawListRow is not the sorted one.

Can anyone help me

Thanks in advance

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.