private void setWeekCountData ( Locale desiredLocale ) { /* try to get the Locale data from the cache */ int [ ] data = cachedLocaleData . get ( desiredLocale ) ; if ( data == null ) { /* cache miss */ data = new int [ 2 ] ; // BEGIN Android-changed: Use ICU4C to get week data. // data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale); // data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale); LocaleData localeData = LocaleData . get ( desiredLocale ) ; data [ 0 ] = localeData . firstDayOfWeek . intValue ( ) ; data [ 1 ] = localeData . minimalDaysInFirstWeek . intValue ( ) ; // END Android-changed: Use ICU4C to get week data. cachedLocaleData . putIfAbsent ( desiredLocale , data ) ; } firstDayOfWeek = data [ 0 ] ; minimalDaysInFirstWeek = data [ 1 ] ; }
Both firstDayOfWeek and minimalDaysInFirstWeek are locale - dependent . They are used to figure out the week count for a specific date for a given locale . These must be set when a Calendar is constructed .