1 回答

TA貢獻1877條經驗 獲得超1個贊
int pos = 0;
JSONObject jsonObject = new JSONObject();
if (jsonObject.has(Integer.toString(pos))) {
} else {
try {
jsonObject.put(Integer.toString(pos),Price);
} catch (JSONException e) {
e.printStackTrace();
}
}
for (int i = 0; i < jsonObj.length(); i++) {
try {
String itemInArray = jsonObj.getString(String.valueOf(i));
int Sum = 0;
int totalPrice = sum + itemInArray;
} catch (JSONException e) {
e.printStackTrace();
}
}
但是代碼不起作用。請提供任何幫助,我們將不勝感激。
添加回答
舉報