Stay organized with collections
Save and categorize content based on your preferences.
public final class LegKt
Summary
Public methods
public static final @NonNull Leg leg(@NonNull Duration duration, int distanceMeters)
Builds a new Leg
.
Parameters |
@NonNull Duration duration |
the time it takes to finish this leg of the trip
|
int distanceMeters |
the distance of this leg of the trip
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eLegKt\u003c/code\u003e is a Kotlin class used for building a \u003ccode\u003eLeg\u003c/code\u003e object in the Places SDK for Android.\u003c/p\u003e\n"],["\u003cp\u003eThe primary function is \u003ccode\u003eleg()\u003c/code\u003e, which creates a new \u003ccode\u003eLeg\u003c/code\u003e instance representing a segment of a journey.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eleg()\u003c/code\u003e requires two parameters: \u003ccode\u003eduration\u003c/code\u003e (time taken) and \u003ccode\u003edistanceMeters\u003c/code\u003e (distance covered) for the leg.\u003c/p\u003e\n"],["\u003cp\u003eThis class helps in constructing detailed route information within the application.\u003c/p\u003e\n"]]],["The `LegKt` class provides a public static method called `leg`. This method constructs a new `Leg` object, representing a segment of a trip. It takes two parameters: `duration`, a `Duration` object indicating the time to complete the leg, and `distanceMeters`, an integer specifying the leg's distance. It then returns the constructed `Leg` object which has been built with the parameters given. Both parameters are non-nullable.\n"],null,["# LegKt\n=====\n\n\n```\npublic final class LegKt\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSummary\n-------\n\n| ### Public methods |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `static final @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull.html)` `[Leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Leg) | [leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/kotlin/LegKt#leg(java.time.Duration,kotlin.Int))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull.html)` `[Duration](https://developer.android.com/reference/java/time/Duration.html)` duration, int distanceMeters)` Builds a new [Leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Leg). |\n\nPublic methods\n--------------\n\n### leg\n\n```\npublic static final @NonNull Leg leg(@NonNull Duration duration, int distanceMeters)\n```\n\nBuilds a new [Leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Leg). \n\n| Parameters |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|\n| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull.html)` `[Duration](https://developer.android.com/reference/java/time/Duration.html)` duration` | the time it takes to finish this leg of the trip |\n| `int distanceMeters` | the distance of this leg of the trip |\n\n| Returns |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull.html)` `[Leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Leg) | the constructed [Leg](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Leg) |"]]