How to add Duration to LocalDateTime for API level lower than 26

◇◆丶佛笑我妖孽 提交于 2019-12-01 06:00:38

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!