问题:
I'm trying to find the difference between two dates (in milliseconds) and all the date/time related functions require API 26.
private var timerStartTime: LocalDateTime? =...
可以将文章内容翻译成中文,广告屏蔽插件会导致该功能失效:
问题:
I'm trying to find the difference between two dates (in milliseconds) and all the date/time related functions require API 26.
private var timerStartTime: LocalDateTime? = null
val now = now()
[...]
if () {
} else if (now.nano - timerStartTime!!.nano <= 800000000) {
}
回答1:
You can't - those Java 8 APIs aren't available on those lower API levels. There are a couple of backports available, however, for example ThreeTenABP.