首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在弹出式ChoiceGroup中设置元素- Java ME

如何在弹出式ChoiceGroup中设置元素- Java ME
EN

Stack Overflow用户
提问于 2012-07-06 11:20:55
回答 1查看 527关注 0票数 2

我正在用Java ME开发一个sms应用程序。它有选择不同运营商的选项。

我已经实现了一个RMS来存储用户名、密码和从弹出式ChoiceGroup中选择的运营商名称。

我需要设置用户在下次登录时从rms中选择的ChoiceGroup元素。

如果我有RMS格式的选定索引或字符串,该如何执行此操作?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-06 14:40:22

我需要设置ChoiceGroup元素...

要做到这一点,最直接的方法是使用append方法。

代码语言:javascript
复制
    myChoiceGroup.append(string1, null);
    myChoiceGroup.append(string2, null);
    // ... etc

在中查找详细信息,它很容易阅读:

代码语言:javascript
复制
public int append(String stringPart,
                  Image imagePart)

    Appends an element to the ChoiceGroup.

    Specified by:
        append in interface Choice

    Parameters:
        stringPart - the string part of the element to be added
        imagePart - the image part of the element to be added,
                    or null if there is no image part 
    Returns:
        the assigned index of the element 
    Throws:
        NullPointerException - if stringPart is null

对于更复杂的用途,有方法insertset,在上面的链接中提供了这些方法的API文档。

为了完整起见,上述方法都是可用的,并且不仅在弹出选项组中具有相似的语义,而且在所有实现Choice接口的对象中都具有相似的语义,包括其他类型的ChoiceGroup和List。

既然您还提到了RMS的工作,那么可以考虑看看another answer中提到的RMS教程。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11355386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档