我想在我的Android项目中创建一个JSONObject。它似乎工作,但似乎只记得我投入它的最后一件事。此代码:如何在Android中创建JSONObject(它会一直忘记)?
JSONObject json = new JSONObject();
try {
json.put("text", "thi sis the message");
json.put("customer_uuid", customer_uuid);
Log.wtf(json.toString(), "asassa");
} catch (JSONException e) {
Log.wtf("WTF", e);
}
打印出{"customer_uuid": "123"}
。但是,当我删除customer_uuid所在的行时,它只打印出{"text", "thi sis the message"}
。
为什么它只记得我放入的最后一件东西?更重要的是,我如何让它存储这两件事?欢迎所有提示!
我们需要看到更多的一点点周围的代码,看看发生了什么事情。 –
您还需要了解更多信息?其余的其余部分完全无关。我只想创建一个JSONObject然后打印出来。你会知道该怎么做吗? – kramer65
定义'it keeps forgetting' – njzk2