The method add(String) is undefined for the type String (JSONObject 2nd Array)

痞子三分冷 提交于 2019-12-25 03:26:11

问题


After reciving the Data from the PHP-File with a MySQL-query, I want to fill two Array with the data. The first Array works:

results.add((String) json_data.get("product") + "\n" + json_data.get("owner"));

But when I add the second Array:

mysql_id.add((String) json_data.get("id")); 

Eclipse displays a Error:

The method add(String) is undefined for the type String

There a no suggestions available and I dont know the Problem. I have "mysql_id" everywhere declard as "results" but it doesnt work!

Thanks for Help!


回答1:


you have to use like this

mysql_id.add(getString("id")); 


来源:https://stackoverflow.com/questions/12620166/the-method-addstring-is-undefined-for-the-type-string-jsonobject-2nd-array

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