BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 01-31-2009, 05:07 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: AT
Posts: 81
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Offline  
Old 01-31-2009, 05:58 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: AT
Posts: 81
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why setSelectedIndex(searchIndex) this method doesn't work in the below code? 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);
if(bolResult)
{

searchIndex=_table.indexOf(entry);
Dialog.inform(""+searchIndex);
listField.setSelectedIndex(searchIndex);
listField.invalidate(searchIndex);

break;
}

// Dialog.inform(""+bolResult);

//}
}
}

//fieldVar.setSelectedIndex(searchIndex);

return searchIndex;
}
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

NEW BRAKE LIGHT SWITCH 12v FITS VESPA SUPER/SPRINT/RALLY MODELS
$8.99
NEW BRAKE LIGHT SWITCH 12v FITS VESPA SUPER/SPRINT/RALLY MODELS pictureDC 110V 220V 100-265V to 36V 5A Switching Power Supply SMPS Adapter AC Inverter
$11.79
DC 110V 220V 100-265V to 36V 5A Switching Power Supply SMPS Adapter AC Inverter picture5A AC-DC Inverter 100-265V to 36V Switching Power Supply Adapter SMPS Module
$11.89
5A AC-DC Inverter 100-265V to 36V Switching Power Supply Adapter SMPS Module pictureAC 125V/250V 3 Pins Blue Car Round Dot LED Light Rocker Toggle Switch
$0.89
AC 125V/250V 3 Pins Blue Car Round Dot LED Light Rocker Toggle Switch picturePyott Boone Model 452 Motion Switch 4-20 MA DSP Tachometer 7-25VDC New
$149.0
Pyott Boone Model 452 Motion Switch 4-20 MA DSP Tachometer 7-25VDC New  picture






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