BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-16-2010, 05:33 AM   #1 (permalink)
New Member
 
Join Date: Feb 2010
Model: 9500
PIN: N/A
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();

listCallback.set_listData(_countries);
_keywordFilterField.setCallback(listCallback);

_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.setColor(0xcccccc);
graphics.drawRect(0, y, width, listField.getHeight());
graphics.setColor(defalutColor);
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
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.