測試代碼片段就像下面的的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