Ich habe eine Arraylist mit JSON-Werten. Ich möchte es in ein Array konvertieren, dann werde ich es an MapActivity senden. Ich habe viele Wege ausprobiert, aber ich habe versagt.haben arraylist wollen es in Array zu konvertieren Ich habe viel Weg verwendet, aber gescheitert
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);
}
Sie brauchen nicht 'stockArr = matchFixtureList.toArray (stockArr);' das passiert im 'toArray'-Aufruf darüber. – zgc7009
Was genau ist das Problem, vor dem Sie stehen? –