【发布时间】:2015-04-27 01:53:09
【问题描述】:
我正在 j2Me 上做一个驾驶执照项目,其中包括像测验这样的测试,嗯,我在解析问题并将它们移动到 choiceGroups 之后遇到了问题:
if (questions.length > 0) {
for (int i = 0; i < questions.length; i++) {
ChoiceGroup reponses = new ChoiceGroup("Reponses" + i, Choice.EXCLUSIVE);
reponses.append(questions[i].getReponse1(), null);
reponses.append(questions[i].getReponse2(), null);
reponses.append(questions[i].getReponse3(), null);
pass.append(questions[i].getContenu());
pass.append(reponses);
}
}
} catch (Exception e) {
System.out.println("Exception:" + e.toString());
}
disp.setCurrent(pass);
下一步是控制choiceGroups 的命令来测试它们是否像真正的答案。 所以我在这里被屏蔽了。
if (c == valider) {
int result = 0;
for (int i = 0; i < pass.size(); i++) {
String ch = pass.get(i).getLabel();
System.out.println(ch);
}
}
我不知道如何从选择组中获得选择 任何帮助
【问题讨论】:
-
什么是 ChoiceGroup?为所有这些发布一些代码。
-
ChoiceGroup 响应 = new ChoiceGroup("Reponses" + i, Choice.EXCLUSIVE); CHoice.Exclusive 就像 Html 中的 radioBox
标签: java xml-parsing java-me