它可以很好地从数据库读取和写入,但会给出 JSONException 错误。 任何帮助将不胜感激!
谢谢
最佳答案
此错误发生在 JSONObject
的 getter 函数中,这意味着您尝试使用 JSONObject 中不存在的 id 从 JSONObject 检索值。在检索值之前,请通过 has(String name)
方法或使用 opt 方法检查它是否确实存在于 JSONObject
中。有关 JSONObject
类的更多信息,请参阅 here .
编辑从错误日志中,错误在 Button
的 OnClickListener
内的 getString
方法中触发命名为btnRegister
。
关于java - JSONException : No value for id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60755419/