测试代码片段就像下面的的JSONObject(地图的copyfrom)构建与Genymotion等模拟器
Map<String, Object> jsonMap = new HashMap<String, Object>();
ArrayList<Long> list = new ArrayList<Long>();
list.add(1L);
list.add(2L);
jsonMap.put("list", list);
JSONObject json = new JSONObject(jsonMap);
JSONArray ja = new JSONArray(list);
try {
json.put("JSONArray", ja);
} catch (JSONException e) {
e.printStackTrace();
}
if (json != null) {
System.out.println(json.toString());
return;
}
与Genymotion
{"JSONArray":[1,2],"list":"[1, 2]"}
的输出与ADT仿真器或我之间的不同结果函数工作nexus 4手机是
{"JSONArray":[1,2],"list":[1,2]}
会发生什么?
它不在我的genymotion。你试图使用哪种genymotion版本和android版本? – pcans 2014-10-13 16:49:59