FileDocCategorySizeDatePackage
ICUCompatIcs.javaAPI DocAndroid 5.1 API2656Thu Mar 12 22:22:56 GMT 2015android.support.v4.text

ICUCompatIcs

public class ICUCompatIcs extends Object

Fields Summary
private static final String
TAG
private static Method
sGetScriptMethod
private static Method
sAddLikelySubtagsMethod
Constructors Summary
Methods Summary
public static java.lang.StringaddLikelySubtags(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.StringgetScript(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;