BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 08-09-2010, 04:36 PM   #1
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default How to load the second list in spinbox if I select/focus an item of the first list?

Please Login to Remove!

How to load the second list in spinbox if I select/focus an item of the first list?

public class SpinTest extends BaseScreen implements FocusChangeListener {

final String[] stateList={"New York","Washington"};
final String[] NYcities={"Manhattan","Queens","Brooklyn","Bronx"} ;
final String[] WashCities={"Seattle","Redmond","Kent","Bellevue"} ;

public SpinTest(){
SpinBoxFieldManager spinBoxMgr = new SpinBoxFieldManager();

SpinBoxField spinBoxStates = new TextSpinBoxField(stateList);
spinBoxStates.setFocusListener(this);

SpinBoxField spinBoxCities= new TextSpinBoxField(NYcities);

spinBoxMgr.add(spinBoxStates );
spinBoxMgr.add(spinBoxCities);

add(spinBoxMgr);
}

public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {

//I have to load all the cities of New York in second wheel if I select "New York" in first wheel
}
else if(sel.equals("Washington")) {
//I have to load all the cities of Washington in second wheel if I select "Washington" in first wheel
}

}
Offline  
Old 08-10-2010, 08:42 AM   #2
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default

Somebody pls help me.
Offline  
Old 08-10-2010, 02:29 PM   #3
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default

When I try with following code, it throws "IllegalArgumentException".
Please somebody help me. It's urgent.

Code:
public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {

//I have to load all the cities of New York in second wheel if I select "New York" in first wheel

TextSpinBoxField desc = new TextSpinBoxField(NYcities);
spinBoxMgr.replace(spinBoxCities,desc);
//spinBoxCities =  new TextSpinBoxField(NYcities);
//How to refresh the manager

}
else if(sel.equals("Washington")) {

//I have to load all the cities of Washington in second wheel if I select "Washington" in first wheel

}

}
Offline  
Old 08-12-2010, 12:02 PM   #4
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default

Solved !!!

Code:
public void focusChanged(Field field, int context) {
if (spinBoxStates== field) {
String sel = (String) spinBoxStates.get(spinBoxStates.getSelectedIndex() );
if (sel.equals("New York")) {
spinBoxCities.setChoices(NYcities);
}
else if(sel.equals("Washington")) {
spinBoxCities.setChoices(WashCities);
}

}

Last edited by romah; 08-12-2010 at 12:04 PM..
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool picture

Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool

$68.50



ProTeam Super QuarterVac Commercial Backpack Vacuum Cleaner w/HEPA Filtration picture

ProTeam Super QuarterVac Commercial Backpack Vacuum Cleaner w/HEPA Filtration

$135.00



4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4

4.5 CFM Single-Stage Rotary Vacuum Pump HVAC/Auto AC 4.5CFM 1/3HP 1/4"ACME inlet

$29.07



10CFM 1HP Vacuum Pump HVAC Field Tool 2 Stage Rotary Vane Fast Deep Vacuum picture

10CFM 1HP Vacuum Pump HVAC Field Tool 2 Stage Rotary Vane Fast Deep Vacuum

$126.99



VacPouch Premium Chamber Vacuum Pouches, Heavy Duty 4mil, PACK OF 500 picture

VacPouch Premium Chamber Vacuum Pouches, Heavy Duty 4mil, PACK OF 500

$77.92



NEW Portable Heavy-Duty Suction Machine HIGH SUCTION VACUUM UNIT PUMP picture

NEW Portable Heavy-Duty Suction Machine HIGH SUCTION VACUUM UNIT PUMP

$139.99







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