I am writing an application where the user needs to specify a given point in time, but i can\'t seem to figure out how to set the minute values that the user can choose from
As a follow up on @Andrey Kotlin solution, you can make it extensible to specify any given minute interval. Also, using kotlin ranges and step keyword, you can have a bit fancier code:
private fun setupMinutesPicker(minVal: Int, maxVal: Int) {
minsNumberPicker.displayedValues = null
minsNumberPicker.minValue = minVal / MINUTE_INTERVAL_STEP
minsNumberPicker.maxValue = maxVal / MINUTE_INTERVAL_STEP
minsNumberPicker.displayedValues = (minVal..maxVal step MINUTE_INTERVAL_STEP)
.toList()
.map { mins -> FORMATTER.format(mins) }
.toTypedArray()
}