我有我的代码有问题的字符串数组,如何将值添加到Android中
我有一个JSON数组
[{"Response":{"data":"sibin1"}},{"Response":{"data":"sibin2"}},
{"Response": {"data":"sibin3"}}]
而且IAM尝试使用下面的代码来提取JSON数据,在这里,我只加
JSONArray finalResult = new JSONArray(tokener);
int finalresultlengt=finalResult.length();
JSONObject json_data = new JSONObject();
for (int i = 0; i < finalResult.length(); i++)
{
json_data = finalResult.getJSONObject(i);
System.out.println("json dataa"+json_data.names().toString());
JSONObject menuObject = json_data.getJSONObject("Response");
result= menuObject.getString("data");
System.out.println(result);
}
的代码工作非常出色
当VALU一些coode的部分的
i=0 ,result is sibin1
i=1 ,result is sibin2
i=2 ,result is sibin3
Ë但我的问题是,我需要的结果存储在长度finalresultlength的字符串数组中给定的循环,还我需要打印值的字符串数组中的为外循环给予循环 如果有人知道请帮助我...........
请重构您的问题以使其可读。修复缩进并尝试添加一些标点符号。 – 2013-02-14 09:18:47
请明确提出问题 – 2013-02-14 09:19:53
在for循环之前声明一个字符串数组'String [] dataStrings = new String [finalResultLength];'然后作为for循环的最后一行添加'dataStrings [i] = result;' – rich200313 2013-02-14 09:20:47