Android - Get List of supported Locales

后端 未结 1 889
余生分开走
余生分开走 2020-12-17 05:58

I have to implement AutoComplete TextView for all the supported locales of Android Device. I tried the following:

 public class Aut         


        
相关标签:
1条回答
  • 2020-12-17 06:17

    Sorry for late reply

    Try this

      Locale[] locales = Locale.getAvailableLocales();
                ArrayList<String> localcountries=new ArrayList<String>();
                for(Locale l:locales)
                {
                    localcountries.add(l.getDisplayLanguage().toString());
                }
        String[] languages=(String[]) localcountries.toArray(new String[localcountries.size()]);
    

    I hope this will help you.

    0 讨论(0)
提交回复
热议问题