任何人都可以告诉我在选择其中一个ObjectChoiceField时切换到另一个屏幕。
谢谢。
答案 0 :(得分:4)
final class HelloWorldScreen extends MainScreen implements FieldChangeListener
{
ObjectChoiceField choice=null;
public HelloWorldScreen()
{
super();
String choicestrs[] = {"Opt 1", "Opt 2", "Opt 3"};
choice = new ObjectChoiceField("Object Choice Field: ", choicestrs, 0);
choice.setChangeListener(this);
add(choice);
}
public void openAnotherForm(){
AnotherForm newScreen = new AnotherForm();
UiApplication.getUiApplication().pushScreen(newScreen);
}
public void fieldChanged(Field arg0, int arg1) {
openAnotherForm();
}
}
class AnotherForm extends MainScreen
{
public AnotherForm()
{
super();
add(new LabelField("Another Form"));
}
}