0

how to get the string in a choicegroup.popup...

here is my sample code...

Form frm=new Form("Sample");
ChoiceGroup cg=new ChoiceGroup("Sample",Choice.POPUP);
frm.append(cg);
cg.append("1");
cg.append("2");
cg.append("3");

int index=cg.getSelectedIndex();
String str=cg.getString(index);

but i got null pointer exception..
anybody knows about it????

Edited by peter_budo: Keep It Clear - Please use code tags when posting code

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by peter_budo
0

You did not indicate selection with setSelectedIndex(int elementNum, boolean selected) . You need to select as GroupChoice is rendered without any pre-selection

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.