我们如何根据先前选择组值的答案在 Java ME (CLDC) 中动态添加 ChoiceGroups
我正在为 CLDC 设备开发 Java ME 应用程序。我有一个要求,即根据之前的回复生成问题。我将从一个选择组开始,然后根据该选择的答案向用户提供另一组问题 - 是/否 - 如果是这个问题或否这个问题。我们该怎么做呢?我是移动应用程序开发的新手。非常感谢任何有关想法或博客文章或文章的帮助,并且有很大帮助。
I am developing a Java ME application for CLDC devices. I have a requirement where the questions are generated based on the previous response. I would start with one choicegroup and then based on the answer to this choices give another set of question to the user- Kind of Yes/No- If Yes this question or No this question. How do we do that? Am novice in mobile app development. Any help in terms of ideas or blog posts or articles is much appreciated and is of great help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读 MIDP2.0 javadocs,并留出一些时间进行试验熟悉 LCDUI API 并熟悉不同组件的工作原理。您是否熟悉
Form
和List
或Screen
和Item
之间的区别?特别是这些类的行为有时会让人感到有些惊讶和困惑。根据平台的不同,它们通常也会产生截然不同的结果。
您可以通过在表单中添加
ItemStateListener
等操作来实现您正在寻找的内容,每当您的第一个ChoiceGroup
时,都会调用其itemStateChanged()
方法代码> 被触及。根据对ChoiceGroup
执行的任何操作,在该方法中添加下一个表单元素。Read the MIDP2.0 javadocs, and set aside some time to just experiment with the LCDUI APIs and become familiar with how the different components work. Are you comfortable with the difference between a
Form
and aList
, or aScreen
and anItem
?These classes in particular can sometimes be slightly surprising and confusing in how they behave. They also often generate quite different results depending on platform.
What you are looking for can be achieved by doing something like adding an
ItemStateListener
to your form, whoseitemStateChanged()
method will get called whenever your firstChoiceGroup
gets touched. Add your next form elements in that method based on whatever action has been performed on theChoiceGroup
.