/** * @param url full URL request * @return the list of POI, of null if technical issue. */ public ArrayList<POI> getThem(String url) { Log.d(BonusPackHelper.LOG_TAG, "NominatimPOIProvider:get:" + url); String jString = BonusPackHelper.requestStringFromUrl(url); if (jString == null) { Log.e(BonusPackHelper.LOG_TAG, "NominatimPOIProvider: request failed."); return null; } try { JSONArray jPlaceIds = new JSONArray(jString); int n = jPlaceIds.length(); ArrayList<POI> pois = new ArrayList<POI>(n); Bitmap thumbnail = null; for (int i = 0; i < n; i++) { JSONObject jPlace = jPlaceIds.getJSONObject(i); POI poi = new POI(POI.POI_SERVICE_NOMINATIM); poi.mId = jPlace.optLong("osm_id"); poi.mLocation = new GeoPoint(jPlace.getDouble("lat"), jPlace.getDouble("lon")); poi.mCategory = jPlace.optString("class"); poi.mType = jPlace.getString("type"); poi.mDescription = jPlace.optString("display_name"); poi.mThumbnailPath = jPlace.optString("icon", null); if (i == 0 && poi.mThumbnailPath != null) { // first POI, and we have a thumbnail: load it thumbnail = BonusPackHelper.loadBitmap(poi.mThumbnailPath); } poi.mThumbnail = thumbnail; pois.add(poi); } return pois; } catch (JSONException e) { e.printStackTrace(); return null; } }