public static String retrieveFieldValueName ( String id , int field , int value , int style , Locale locale ) { // Android-changed: delegate to ICU. if ( field == Calendar . ERA ) { // For era the field value does not always equal the index into the names array. switch ( normalizeCalendarType ( id ) ) { // These calendars have only one era, but represented it by the value 1. case BUDDHIST_CALENDAR : case ISLAMIC_CALENDAR : value -= 1 ; break ; case JAPANESE_CALENDAR : // CLDR contains full data for historical eras, java.time only supports the 4 // modern eras and numbers the modern eras starting with 1 (MEIJI). There are // 232 historical eras in CLDR/ICU so to get the real offset, we add 231. value += 231 ; break ; default : // Other eras use 0-based values (e.g. 0=BCE, 1=CE for gregorian). break ; } } if ( value < 0 ) { return null ; } String [ ] names = getNames ( id , field , style , locale ) ; if ( value >= names . length ) { return null ; } return names [ value ] ; }
use libcore . icu . LocaleData or android . icu . util . Calendar . WeekData instead