在BasicEditField
从. _ _ObjectChoiceField
问题:BasicEditField
我添加到屏幕的字段不会刷新,除非我在我的ObjectChoiceField
.
我想做的事 :
- 选择
BasicEditFields
我想要的号码。 - 刷新屏幕以显示添加的字段。
PD:如果您需要更多信息,请告诉我,对不起我的英语。我是为 BlackBerry 平台开发的新手
public final class MyScreen extends MainScreen
{
private int fields_lenght;
public MyScreen()
{
// Set the displayed title of the screen
setTitle("Example");
fields_lenght =0;
final String shortcodes[] = {"1","2","3"};
final ObjectChoiceField dropdownlist=new ObjectChoiceField("Select a number of fields",shortcodes);
this.add(dropdownlist);
dropdownlist.setChangeListener( new FieldChangeListener() {
public void fieldChanged( Field arg0, int arg1 ) {
if(arg1 != PROGRAMMATIC){
fields_lenght= Integer.parseInt(shortcodes[dropdownlist.getSelectedIndex()]);
}
}
} );
// how to refresh the screen with the new fields ???
BasicEditField fields[]=new BasicEditField [fields_lenght] ;
for(int i = 0; i<fields.length;i++){
fields[i]=new BasicEditField("Campo "+i,"");
this.add(fields[i]);
}
}
}