Friday, August 12, 2005

BB : Getting selected item in ObjectChoiceField

String [] choices = {"A", "B", "C"};

ocfChoice = new ObjectChoiceField ("Select choice", choices, 0) ;
add (ocfChoice);

int index = ocfChoice.getSelectedIndex();
String selectedChoice = choices [index];

Enjoy!

(Blackberry)

1 comment:

Kelly said...

This is great, exactly what I've been looking for - now how do I load the persisted String back into the ObjectChoiceField?