So I'm trying to load all weeks of the year using ThreeTenABP library, but I have no idea where to start because there is no documentation. At least I couldn't find any. Please help me out.
Asked
Active
Viewed 192 times
1 Answers
2
ThreeTenABP is just an Android-specific adaptation of the ThreeTen-Backport Java project.
ThreeTen-Backport is a back-port of the Java SE 8 date-time classes (java.time) to Java SE 6 and 7. You can find its documentation here.
Code from this answer:
private static long getNumberOfWeeksInYear(LocalDate date) {
LocalDate middleOfYear = date.withDayOfMonth(1).withMonth(6);
return middleOfYear.range(WeekFields.ISO.weekOfWeekBasedYear()).getMaximum();
}
And you can call it passing the following parameter:
LocalDate.of(year, 1, 1) // replace year by the the year you want, e.g. 2009

Gustavo Pagani
- 6,583
- 5
- 40
- 71
-
2Correct Answer, but you should point them to the class [JavaDoc of *ThreeTen-Backport*](https://www.threeten.org/threetenbp/apidocs/index.html) rather than the *java.time* classes. While the back-port has *most* of the *java.time* functionality, it does not have *all*. There are a few differences. – Basil Bourque Apr 20 '19 at 21:05
-
1Add a link to the Question, [*How to use ThreeTenABP in Android Project*](https://stackoverflow.com/q/38922754/642706). – Basil Bourque Apr 20 '19 at 21:06
-
Thanks Basil, just edited the answer pointing to the correct javadoc. That's a great answer from the link above, thanks for that too! – Gustavo Pagani Apr 20 '19 at 21:14