Skip to content

Most visited

Recently visited

navigation

ICU4J Android Framework APIs

ICU4J is an open-source, widely used set of Java libraries providing Unicode and globalization support for software applications. Starting in Android 7.0 (API level 24), Android exposes a subset of the ICU4J APIs for app developers to use under the android.icu package. These APIs use localization data present on the device. As a result, you can reduce your APK footprint by not compiling the ICU4J libraries into your APK; instead, you can simply call out to them in the framework. (In this case, you may want to provide multiple versions of your APK, so users running versions of Android lower than Android 7.0 (API level 24) can download a version of the app that contains the ICU4J libraries.)

This document begins by providing some basic information on the minimum Android API levels required to support these libraries. It then explains what you need to know about the Android-specific implementation of ICU4J. Finally, it tells you how to use the ICU4J APIs in the Android framework.

Relationship to ICU4J

Android exposes a subset of the ICU4J APIs via the android.icu package, rather than com.ibm.icu. The Android framework may choose not to expose ICU4J APIs for various reasons; for example, Android does not expose some deprecated APIs or those that the ICU team have not yet declared as stable. As the ICU team deprecates APIs in the future, Android will also mark them as deprecated but will continue to include them.

Table 1. ICU and CLDR versions used in Android.

Android API level ICU version CLDR version
Android 7.0 (API level 24), Android 7.1 (API level 25) 56 28

Here are a few important things to note:

Migrating to the android.icu package from com.ibm.icu

If you are already using the ICU4J APIs in your app, and the android.icu APIs meet your requirements, then migrating to the framework APIs requires you to change your Java imports from com.ibm.icu to android.icu. You may then remove your own copy of ICU4J files from the APK.

Note: The ICU4J framework APIs use the android.icu namespace instead of com.ibm.icu. This is to avoid namespace conflicts in APKs that contain their own com.ibm.icu libraries.

Migrating to android.icu APIs from other Android SDK APIs

Some classes in the java andandroid packages have equivalents to those found in ICU4J. However, ICU4J often provides broader support for standards and languages.

Here are some examples to get you started:

Class Alternatives
java.lang.Character android.icu.lang.UCharacter
java.text.BreakIterator android.icu.text.BreakIterator
java.text.DecimalFormat android.icu.text.DecimalFormat
java.util.Calendar android.icu.util.Calendar
android.text.BidiFormatter android.icu.text.Bidi
android.text.format.DateFormat android.icu.text.DateFormat
android.text.format.DateUtils android.icu.text.DateFormat android.icu.text.RelativeDateTimeFormatter

Licensing

ICU4J is released under the ICU license. For details, see the ICU User Guide.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.