I want to get a Place
object from the Google Places API in an app I build in android studio.
I'm using this code to do so:
List<Place.Field> placeFields = Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.ADDRESS, Place.Field.OPENING_HOURS);
FetchPlaceRequest request = FetchPlaceRequest.newInstance(chosenPlaceId, placeFields);
final PlacesClient placesClient = Places.createClient(this);
placesClient.fetchPlace(request).addOnSuccessListener((response) -> {
Place chosenPlace = response.getPlace();
...
I want to use the returned Place object, but I couldn't get it outside the lambda scope. I've seen some suggested solutions, but I couldn't make them work in my case. Is there a simple non-hacky way of doing that?
Thanks.