2
所以創建一個ArrayList我有一個JSON就像下面存儲MYJSON
圖片 -從JSON對象
我的計劃是從childObject0
檢索所有的對象,並將其存儲在一個ArrayList
所以他們可以稍後處理。所以我沒有 -
ArrayList<String> childLists = new ArrayList<String>();
try {
JSONArray childArray = MYJSON.getJSONArray("childObject0");
for (int i = 0; i<jArray.length(); i++
) {
//I lost it here! How can I append to `childList` from `childArray`?
}
} catch (JSONException e) {
e.printStackTrace();
}
無法弄清楚如何追加。這是正確的方法嗎? childObject0
是動態的,計數會隨時變化。 謝謝
使用'ArrayList'保存了一天! –
envyM6