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

MOTOROLA F2885A Remote Terminal Unit w/3xFRN1457A Output & 1xFRN1456A CPU WORKS
$49.99
MOTOROLA F2885A Remote Terminal Unit w/3xFRN1457A Output & 1xFRN1456A CPU WORKS pictureOLFA safety purport processor poke PRO 211B
$8.19
OLFA safety purport processor poke PRO 211B picture1-1/2" 300# Micro Motion T150 Flow Sensor w/ Core Processor 2015 NEW Z99 (2327)
$7000.0
1-1/2New Allen Bradley 1785-L20B /E 1785L20B PROCESSOR 16K
$349.99
New Allen Bradley 1785-L20B /E 1785L20B PROCESSOR 16K pictureGE Fanuc IC695CPU310-CC RX3i 300MHz CPU Module As Is Bad Comms
$189.95
GE Fanuc IC695CPU310-CC RX3i 300MHz CPU Module As Is Bad Comms picture






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