Oggi sto cercando di ottimizzare il mio JSONArray per android developer documentation. Dovevo ottimizzarlo ma c'è un messaggio di errore in uscita.Ottimizza JSonArray for Loop
JSONArray infojson = json.getJSONArray("getInfo");
for(int i=0;i < infojson.length();i++){
JSONObject e = infojson.getJSONObject(i);
hm = new HashMap<String, Object>();
hm.put(MYNAME, e.getString("uname"));
hm.put(MYAGE, e.getString("uage"));
}
E ho ottimizzato al di sopra di codifica da seguire
JSONArray infojson = jsonObject.getJSONArray("getInfo");
for (Object o : infojson) {
JSONObject jsonLineItem = (JSONObject) o;
String myname = jsonLineItem.getString("uname");
String myage = jsonLineItem.getString("uage");
}
Purtroppo, ho ottenuto il seguente messaggio di errore che si verificano sul "infojson) {"
possibile scorrere solo su un array o un'istanza di java.lang.Iterable
Il mio JSON è di circa 650.000 byte. Conta anche come 'non grande '? – choz