That's pretty much what I need as well.
I want to detect the user language and to check if some of the languages I've translated my app to coincides the current user interface language.
Your reflection method returns full language names. I turned my Phone to Russian and Polish and these are the results:
руский (Польша) which means Russian(Poland)
polski (Rumunia) which means Polish(Romania).
And now, to summarize the question - is this the correct way to do it?
I can easily check if the returned string includes ("english") or (polski) or ("deutsch").
I tried checking this with AHLocale but it doesn't seem to return the current activated language. It just returns the list of available locales. I will not be using this library for the translation processes, I have my own map of strings.
Maybe it would be better if I can get it like this: en, de, bg, gr, etc...
Edit:
I found my mistake, I just had to do initliaze which initializes the locale object with the default language.
But as for the reflection method, what should "getDisplayName" be replaced with?
Edit2:
Solved it with some reading about java.util.Locale.
Return r.RunMethod("getLanguage")