Kam*_*roi 3 android json android-studio
String value = myInput.getText().toString();
Run Code Online (Sandbox Code Playgroud)
我想将字符串值放入JSONObject.put("STRING",value)方法中,但它不起作用。
请参阅随附的屏幕截图并了解如何解决此问题。
添加try.. catch
String data = "";
String val = "hello";
try {
JSONObject j = new JSONObject(data);
j.put("VAL", val);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14244 次 |
| 最近记录: |