formatDistance

fun formatDistance(distanceInMeters: Double, roundingIncrement: Int, unitType: UnitType, context: Context, locale: Locale): FormattedDistanceData

This will recalculate and format a distance based on the parameters inputted. The value will be rounded for visual display and a distance suffix like 'km' for kilometers or 'ft' for foot/feet will be included.

Return

an object containing values for displaying the formatted distance

Parameters

distanceInMeters

in meters

roundingIncrement

used to alter the original value for display purposes

unitType

indicates whether the value should be returned as metric or imperial

context

a context for determining the correct value for the distance display, for example 3.5 or 3,5

locale

a specified locale to use rather than the default locale provided by the context

fun formatDistance(distanceInMeters: Double, roundingIncrement: Int, unitType: UnitType, context: Context): FormattedDistanceData

This will recalculate and format a distance based on the parameters inputted. The value will be rounded for visual display and a distance suffix like 'km' for kilometers or 'ft' for foot/feet will be included.

Return

an object containing values for displaying the formatted distance

Parameters

distanceInMeters

in meters

roundingIncrement

used to alter the original value for display purposes

unitType

indicates whether the value should be returned as metric or imperial

context

a context for determining the correct value for the distance display, for example 3.5 or 3,5

fun formatDistance(distanceInMeters: Double, roundingIncrement: Int, unitType: UnitType): Double

This will recalculate and format a distance based on the parameters inputted. The value will be rounded for visual display and a distance suffix like 'km' for kilometers or 'ft' for foot/feet will be included.

Return

an object containing values for displaying the formatted distance

Parameters

distanceInMeters

in meters

roundingIncrement

used to alter the original value for display purposes

unitType

indicates whether the value should be returned as metric or imperial