Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Places API - android
    primarykey
    data
    text
    <p>I am making an android application that needs to search in my local area within 10km and display the results onto a map using pins, For example: "Starbucks", "Wallmart", Shopping mall, etc. The search word that i specify in my activity class. And to be clear: I do NOT want to open the search in Google maps, i want it to display the results inside MY own application. But i get an error at the code that executes the search. The error comes up on the following things:</p> <p>Url: url cannot be resolved or is not a field Execute: The method execute() is undefined for the type HttpRequest Response: response cannot be resolved or is not a field</p> <p>I am using three packages: com.mycompany.applicationname = Default package, containing main code, including the search code com.mycompany.applicationname.Model = Containing PlaceAutoComplete, PlacesList, Place, etc. com.mycompany.applicationname.PlacesRequests = Containing PlaceRequest.java</p> <p>Please help me, i really need help and thanks SO much in advance</p> <p>This is the code that i am using to execute the search:</p> <pre><code> private static final String PLACES_SEARCH_URL = "https://maps.googleapis.com/maps/api/place/search/json?"; private static final boolean PRINT_AS_STRING = false; public void performSearch() throws Exception { try { System.out.println("Perform Search ...."); System.out.println("-------------------"); HttpRequestFactory httpRequestFactory = createRequestFactory(transport); HttpRequest request = httpRequestFactory.buildGetRequest(new GenericUrl(PLACES_SEARCH_URL)); request.url.put("key", API_KEY); request.url.put("location", lat + "," + lng); request.url.put("radius", 500); request.url.put("sensor", "false"); if (PRINT_AS_STRING) { System.out.println(request.execute().parseAsString()); } else { PlacesList places = request.execute().parseAs(PlacesList.class); System.out.println("STATUS = " + places.status); for (Place place : places.results) { System.out.println(place); } } } catch (HttpResponseException e) { System.err.println(e.response.parseAsString()); throw e; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload