HashTable到Lwuit表 [英] HashTable to Lwuit Table

查看:79
本文介绍了HashTable到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表,该值将在下面显示形式. 名字Jhon 地址印度 请帮助我提供源代码,因为我是J2me Application的新手.请记住不要对键和值进行核算,我们在解析后会得到值.

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.

推荐答案

您无法执行此操作,因为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.

尽管您可以通过实现树模型接口将JSON数据显示为树,但它并不琐碎,但也不太难.您只需要返回键的键对象(而不是字符串),这样它们就可以包括对value元素的引用.

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.

这篇关于HashTable到Lwuit表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆