哈希表到 Lwuit 表
Hashtable iHashtable=new Hashtable();
iHashtable.put("Name", "Jhon");
iHashtable.put("Address","India");
Enumeration iEnumeration=iHashtable.keys();
while(iEnumeration.hasMoreElements())
{
Object iresult1=iEnumeration.nextElement();
String iresult2=(String) iHashtable.get(iresult1);
System.out.println(iresult1);
System.out.println(iresult2);
我的问题是我想使用 HashTable 键和值动态地将值放在 LWUIT 表中,这里是 iresult1 和 iresult2,使用键和值我想创建 LWUIT 表,其中值将以以下形式显示。 姓名 约翰 地址印度 请帮助我处理源代码,因为我是 J2me 应用程序的新手。请记住不要硬核键和值,我们在解析后得到值。
Hashtable iHashtable=new Hashtable();
iHashtable.put("Name", "Jhon");
iHashtable.put("Address","India");
Enumeration iEnumeration=iHashtable.keys();
while(iEnumeration.hasMoreElements())
{
Object iresult1=iEnumeration.nextElement();
String iresult2=(String) iHashtable.get(iresult1);
System.out.println(iresult1);
System.out.println(iresult2);
My problem is I want to put the value at LWUIT table dynamically using the HashTable key and value,here is iresult1 and iresult2,using the key and value I want to create the LWUIT table where the value will be shown in the following form.
Name Jhon
Address India
please help me with the source code because i am new in J2me Application.please remember don't hardcore the key and value ,we get the value after parsing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能这样做,因为 JSON 数据不是表格形式的,而是基于服务器响应的嵌套哈希表和向量的层次结构。
您可以通过实现树模型接口将 JSON 数据显示为树,这并不简单,但也不太难。您只需要返回键的键对象(而不是字符串),这样它们就可以包含对值元素的引用。
You can't do that since the JSON data isn't tabular but rather a hierarchy of nested hashtables and vectors based on the response from the server.
You can show the JSON data as a tree though by implementing the tree model interface, its not trivial but not too hard. You just need to return key objects for the keys (instead of strings) so they will allow including a reference to the value element.