Searching for list item
Please Login to Remove!
Hi,
I am posting more than a thread because i have not found any solution for selecting particular row in the ListField though i have implemented the indexOfList method .
My written code looks like below,
public int getPreferredWidth(ListField fieldVar)
{
//use all the width of the current LCD
return Graphics.getScreenWidth();
}
int searchIndex;
boolean bolResult;
public int indexOfList
(ListField fieldVar,String prefix,int start)
{
for (int a=0; a<_table.size();a++)
{
Object obj= _table.elementAt(a);
if(obj instanceof String)
{
String entry =(String)obj;
bolResult = entry.startsWith(prefix);
if(entry.startsWith(prefix)==true);
{
searchIndex=_table.indexOf(entry);
// Dialog.inform(""+bolResult);
break;
}
}
}
fieldVar.setSelectedIndex(searchIndex);
return _table.indexOf(prefix,start);
}
Am i doing something worng,please quick response will be appreciated.
|