Add方法(字符串)是未定义String类型(JSONObject的第二个阵列) [英] The method add(String) is undefined for the type String (JSONObject 2nd Array)

查看:655
本文介绍了Add方法(字符串)是未定义String类型(JSONObject的第二个阵列)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从PHP-文件与一个MySQL查询reciving数据后,我想填充两个阵列上的数据。
第一个数组如下:

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显示一个错误:

Eclipse displays a Error:

Add方法(字符串)是不确定的String类型

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

有一个没有可用的建议,我不知道这个问题。
我有mysql_id无处不declard为结果,但它不工作!

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

感谢您的帮助!

推荐答案

您必须使用这样的

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

这篇关于Add方法(字符串)是未定义String类型(JSONObject的第二个阵列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆