0

How do i get the following lists in code?

First one is the OS langauge as i see it in my device language setting

OS language

The second one is the keyboard input languages

keyboard input language

When i use Locale.getAvailableLocales() i get list with 600 results.
When i open language selection i see 100 results in list.(Screenshot1)
When i open keyboard languages selection i see 200 results in list.(Screenshot2)
How the OS filter those 600 result to get 100 and 200 lists?
How can i do that?

6
  • @DerGolem That not what i am asking and if you read the question you can see that i stated that Locale.getAvailableLocales() is not what i need. Commented Apr 15, 2015 at 11:16
  • Then tell me which other method you'd like to use, I'm curious. Commented Apr 15, 2015 at 11:17
  • That's exactly what i asked. How they populate those list when choosing languages and how i can do it. Commented Apr 15, 2015 at 11:19
  • @DerGolem And that a great idea to close question when you don't know the answer. Commented Apr 15, 2015 at 11:21
  • I know the answer. But you don't accept it. So, for me, the question is closed. Also notice that you need 5 votes to close a question. So mine is only a mere 20%. Maybe, your post will remain open? Commented Apr 15, 2015 at 11:23

1 Answer 1

1

According to Android source code, this is how the locales are retrieved:

Resources.getSystem().getAssets().getLocales();

Also note that the code I linked does a number of checks to build the list that gets actually displayed so you might need to go through it to get the exact same result.

2
  • The code you linked is how to get result of screenshot1 or screenshot2 ? Commented Apr 15, 2015 at 11:48
  • Actually, I'm not sure. It might be a generic LocalePicker used across the Settings part of Android. Commented Apr 15, 2015 at 11:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.