JSONException: No value for id

核能气质少年 提交于 2021-02-16 18:18:27

问题


It reads and writes fine from the database but gives the JSONException error. Any help would be greatly appreciated!

Thank you


回答1:


This error happens in getter functions of a JSONObject and it means that you are trying to retrieve a value from the JSONObject using an id that doesn't exist in the JSONObject. Before retrieving a value, check if it actually exists in the JSONObject by the has(String name) method or using the opt methods. For more information about the JSONObject class see here.

EDIT From your error log, the error triggers in a getString method inside the OnClickListener of your Button named btnRegister.



来源:https://stackoverflow.com/questions/11458661/jsonexception-no-value-for-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!