Such mini example, in Java I have:
public static void getPlaceName(GoogleApiClient mGoogleApiClient, String placeId, @NonNull PlaceNameCallback callback) {
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId)
.setResultCallback(places -> {
if (places.getStatus().isSuccess() && places.getCount() > 0) {
Place myPlace = places.get(0);
callback.onPlaceDetected(String.valueOf(myPlace.getName())); // set place name
}
places.release();
});
}
public interface PlaceNameCallback {
void onPlaceDetected(String name);
}
And then I can set place name to TextView:
getPlaceName(mGoogleApiClient, arrivalId[0], name -> textArrival.setText(name));
Please tell me how to set place name like this on Kotlin?