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
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

iBASE IB820H SBC Single Board Computer / Pentium 4 2.8 / 2 GB RAM
$175.0
iBASE IB820H SBC Single Board Computer / Pentium 4 2.8 / 2 GB RAM pictureGreenlee 7306 ram knockout & hand pump hydraulic driver punch 1/2" to 2" kit #2
$324.99
Greenlee 7306 ram knockout & hand pump hydraulic driver punch 1/2DYNAPATH EPROM/RAM CARRIER 4202259
$219.0
DYNAPATH EPROM/RAM CARRIER 4202259 pictureIntermec CV61 CV61A127MAN80000 Mobile Computer, 2GB RAM, 40GB SSD, Win 7
$1190.0
Intermec CV61 CV61A127MAN80000 Mobile Computer, 2GB RAM, 40GB SSD, Win 7  pictureIBM 4835-152 POS Touchscreen Terminal Kiosk 15" 1GB RAM
$121.77
IBM 4835-152 POS Touchscreen Terminal Kiosk 15






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