我们如何根据先前选择组值的答案在 Java ME (CLDC) 中动态添加 ChoiceGroups

发布于 2024-08-28 09:05:09 字数 161 浏览 3 评论 0原文

我正在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱娆 2024-09-04 09:05:09

阅读 MIDP2.0 javadocs,并留出一些时间进行试验熟悉 LCDUI API 并熟悉不同组件的工作原理。您是否熟悉 FormListScreenItem 之间的区别?

特别是这些类的行为有时会让人感到有些惊讶和困惑。根据平台的不同,它们通常也会产生截然不同的结果。

您可以通过在表单中​​添加 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 a List, or a Screen and an Item?

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, whose itemStateChanged() method will get called whenever your first ChoiceGroup gets touched. Add your next form elements in that method based on whatever action has been performed on the ChoiceGroup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文