I know that already exists a Locale.getAvailableLocales() function and some other similars witch returns all the avaiable languages (regardless of whether they are available on your mobile phone or no)
I'm looking a method to return just the languages that i made the translation (i.e.: if i have the 3 folders values-en, valu开发者_开发问答es-es, values-pt; i hope get the response: [en, es, pt], or [english, spanish, portuguese]
Locale.getAvailableLocales()
will give you a list of system-wide available Locales. These are used to format dates, times, numbers and alike. It has nothing to do with your application localization files.
I am guessing that you want to switch languages at runtime and that is why you want to enumerate over list of languages. Well, you probably need to create specific configuration file with that list and read that at runtime. Adding L10n files would require another step - registering it in you configuration file.
Alternatively you may want to enumerate resource directories (values-<Locale-ID>) and grab supported Locales from their names, but I don't think it is the most elegant solution. However, it works without any registration...
精彩评论