Period.parse() requires API level 26. Is there any workaround to use it with minimum API level 17.
I am using
Period snoozeTime = Period.parse(rs.getString(rs.getColumnIndex("snoozeTime")));
Period.parse() requires API level 26. Is there any workaround to use it with minimum API level 17.
I am using
Period snoozeTime = Period.parse(rs.getString(rs.getColumnIndex("snoozeTime")));
The main advantage of using ThreetenABP (a wrapper around the backport of JSR-310) might be to get the same feeling as if you use java.time.Period
, but you have to change the import statement, namely org.threeten.bp.Period
.
Duration parsers for Android are also available in Joda-Time-Android (called PeriodFormatter
) or in my lib Time4A (for example pattern-based or as ISO-8601-parsing-methods in class Duration).
Note that the external APIs of Joda-Time and Time4J/A are superior to the parsing capabilities of JSR-310-class java.time.Period
. Latter one can only understand some few ISO-8601-standard formats.
Just use Java 8+ API desugaring support. Take a look: https://developer.android.com/studio/write/java8-support#library-desugaring
It's meant to provide the new java 8 features on Android with older apis
It's even recommended by ThreetenABP in its github page