HashTable to Lwuit Table

回眸只為那壹抹淺笑 提交于 2019-12-25 03:52:43

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/7075536/hashtable-to-lwuit-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!