ICUCompatIcspublic class ICUCompatIcs extends Object
Fields Summary |
---|
private static final String | TAG | private static Method | sGetScriptMethod | private static Method | sAddLikelySubtagsMethod |
Methods Summary |
---|
public static java.lang.String | addLikelySubtags(java.lang.String locale)
try {
if (sAddLikelySubtagsMethod != null) {
final Object[] args = new Object[] { locale };
return (String) sAddLikelySubtagsMethod.invoke(null, args);
}
} catch (IllegalAccessException e) {
// Nothing we can do here, we just log the exception
Log.w(TAG, e);
}
catch (InvocationTargetException e) {
// Nothing we can do here, we just log the exception
Log.w(TAG, e);
}
return locale;
| public static java.lang.String | getScript(java.lang.String locale)
try {
final Class<?> clazz = Class.forName("libcore.icu.ICU");
if (clazz != null) {
sGetScriptMethod = clazz.getMethod("getScript",
new Class[]{ String.class });
sAddLikelySubtagsMethod = clazz.getMethod("addLikelySubtags",
new Class[]{ String.class });
}
} catch (Exception e) {
// Nothing we can do here, we just log the exception
Log.w(TAG, e);
}
try {
if (sGetScriptMethod != null) {
final Object[] args = new Object[] { locale };
return (String) sGetScriptMethod.invoke(null, args);
}
} catch (IllegalAccessException e) {
// Nothing we can do here, we just log the exception
Log.w(TAG, e);
}
catch (InvocationTargetException e) {
// Nothing we can do here, we just log the exception
Log.w(TAG, e);
}
return null;
|
|