/** * Method takes a base address and establishments and return the addresses * * @param baseLocation * @param establishmentType * @return allResults */ public static String[][] GetAddresses(String baseLocation, String[] establishmentType) { PlacesSearchResponse responses; String[][] allResults = new String[establishmentType.length][]; for (int type = 0; type < establishmentType.length; type++) { try { responses = PlacesApi.textSearchQuery(context, establishmentType[type] + " near " + baseLocation) .await(); allResults[type] = new String[responses.results.length]; for (int i = 0; i < responses.results.length; i++) { PlacesSearchResult result = responses.results[i]; allResults[type][i] = (result.name + " " + result.formattedAddress); } } catch (Exception e) { e.printStackTrace(); } } return allResults; }