I am developing an application for API level 19 (KitKat).
I have a LocalDateTime
object and a Duration
object. I need to add this Duration
to LocalDateTime
.
Android Studio shows that plus(TemporalAmount)
method of LocalDateTime
class is avaliable since API level 26 which is Oreo and it supports less than 1% of devices right now.
How can I do it with API level 19?
The bbb answer in the comments is correct.
Currently the best option for android is ThreeTenABP. Jake Wharton explains why it's better to use this library rather than Joda-Time and ThreeTenBP in Android.
来源:https://stackoverflow.com/questions/48910142/how-to-add-duration-to-localdatetime-for-api-level-lower-than-26