use of cl.smartcities.isci.transportinspector.backend.MapBus in project androidApp by InspectorIncognito.
the class GetBusesRequest method processResult.
@NonNull
@Override
public Pair<ArrayList<MapBus>, ArrayList<Event>> processResult(@NonNull String result) {
ArrayList<MapBus> busResponse = new ArrayList<>();
ArrayList<Event> eventResponse = new ArrayList<>();
try {
JSONObject response = new JSONObject(result);
JSONArray buses = response.getJSONArray("servicios");
JSONArray events = response.getJSONArray("eventos");
Log.d("Callback events", events.toString());
for (int i = 0; i < buses.length(); i++) {
try {
MapBus bus = new MapBus(buses.getJSONObject(i));
busResponse.add(bus);
} catch (JSONException ignored) {
}
}
for (int i = 0; i < events.length(); i++) {
// Event event = new Event(events.getJSONObject(i));
// eventResponse.add(event);
}
return new Pair<>(busResponse, eventResponse);
} catch (JSONException e) {
e.printStackTrace();
Log.e("GetBusesRequest", result);
}
return new Pair<>(busResponse, eventResponse);
}
Aggregations