哈希表到 Lwuit 表

发布于 2024-11-29 18:45:28 字数 613 浏览 2 评论 0原文

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 技术交流群。

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

发布评论

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

评论(1

绳情 2024-12-06 18:45:28

您不能这样做,因为 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.

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