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();
}
}
但是代码不起作用。请提供任何帮助,我们将不胜感激。
添加回答
举报