protected void onPostExecute(String jSONOfPlaces) { // CPSC 210 Students: Given JSON from FourQuest, parse it and load // PlaceFactory JSONObject obj = null; try { obj = new JSONObject(jSONOfPlaces); JSONObject response = obj.getJSONObject("response"); JSONArray items = response.getJSONArray("groups").getJSONObject(0).getJSONArray("items"); for (int i = 0; items.length() > i; i++) { // parse out the info needed to construct a eating place String name = items.getJSONObject(i).getJSONObject("venue").getString("name"); Double lat = items .getJSONObject(i) .getJSONObject("venue") .getJSONObject("location") .getDouble("lat"); Double lng = items .getJSONObject(i) .getJSONObject("venue") .getJSONObject("location") .getDouble("lng"); // construct eating place EatingPlace ep = new EatingPlace(name, new LatLon(lat, lng)); // add eating place to placefactory PlaceFactory places = PlaceFactory.getInstance(); places.add(ep); } } catch (JSONException e) { e.printStackTrace(); } // Display how many places added to the placefactory int num = PlaceFactory.getInstance().getNumberOfPlaces(); AlertDialog aDialog = createSimpleDialog("Found " + num + " Places near UBC"); aDialog.show(); }