Exemple #1
0
    /// <summary>
    /// Convert the locale object in parameter to java.util.Locale object and return it.
    /// </summary>
    /// <param name="locale"></param>
    /// <returns>java.util.Locale instance object</returns>
    private AndroidJavaObject ToJavaLocaleObject(Locale locale)
    {
        AndroidJavaObject javaLocaleObj = null;

        using (AndroidJavaClass cls = new AndroidJavaClass("java.util.Locale"))
        {
            if (Locale.Contains(locale))
            {
                javaLocaleObj = cls.GetStatic <AndroidJavaObject>(locale.ToString());
            }
            else
            {
                javaLocaleObj = engine.Call <AndroidJavaObject>("createLocale", locale.language, locale.country);
            }
        }
        return(javaLocaleObj);
    }