我有一个带有 JSON 值的数组列表。我想将其转换为数组,然后将其发送给 MapActivity。我尝试了很多方法,但都失败了。
for (int i = 0; i < matchFixture.length(); i++)
{
JSONObject c = matchFixture.getJSONObject(i);
String matchId = c.getString(TAG_MATCHID);
Log.d("matchId", matchId);
// hashmap for single match
HashMap<String, String> matchFixture = new HashMap<String, String>();
// adding each child node to HashMap key => value
matchFixture.put(TAG_MATCHID, matchId);
matchFixtureList.add(matchFixture);
//item=matchFixtureList.get(0).toString();
String[] stockArr = matchFixtureList.toArray(new String[matchFixtureList.size()]);
stockArr = matchFixtureList.toArray(stockArr);
for(String s : stockArr)
System.out.println(s);
}