问题
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