I have the following code but I don't understand how it went wrong with the result I wanted, At first I have a total time which is supposed to be of type Long (Milisecond) and then I need to convert it to a format mm: ss is not a format (HH: mm: ss), So who can help I convert it to mm:ss format
private fun startCounting() {
var i = 60100
val totalSeconds =
TimeUnit.MINUTES.toSeconds(i.toLong())
Handler().postDelayed({
val tickSeconds = 0
for (second in tickSeconds until totalSeconds) {
val time =
String.format(
"%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(second),
TimeUnit.MILLISECONDS.toSeconds(second) % TimeUnit.MINUTES.toMinutes(1)
)
}
}, 1000)
}
Thanks You