我正在用Java ME开发一个sms应用程序。它有选择不同运营商的选项。
我已经实现了一个RMS来存储用户名、密码和从弹出式ChoiceGroup中选择的运营商名称。
我需要设置用户在下次登录时从rms中选择的ChoiceGroup元素。
如果我有RMS格式的选定索引或字符串,该如何执行此操作?
发布于 2012-07-06 14:40:22
我需要设置ChoiceGroup元素...
要做到这一点,最直接的方法是使用append方法。
myChoiceGroup.append(string1, null);
myChoiceGroup.append(string2, null);
// ... etc在中查找详细信息,它很容易阅读:
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对于更复杂的用途,有方法insert和set,在上面的链接中提供了这些方法的API文档。
为了完整起见,上述方法都是可用的,并且不仅在弹出选项组中具有相似的语义,而且在所有实现Choice接口的对象中都具有相似的语义,包括其他类型的ChoiceGroup和List。
既然您还提到了RMS的工作,那么可以考虑看看another answer中提到的RMS教程。
https://stackoverflow.com/questions/11355386
复制相似问题