Finally i got what i was looking for after lot of brain hamering.this gives me list of langauges that are displayed under langauge and input settings
public void getLangs()
{
String[] systemLocaleIetfLanguageTags = getAssets().getLocales();
Arrays.sort(systemLocaleIetfLanguageTags);
this.data = new ArrayList();
for (String ietfLanguageTag : systemLocaleIetfLanguageTags)
{
if (ietfLanguageTag != null && ietfLanguageTag.length() == 5)
{
this.data.add(new Loc(ietfLanguageTag));
}
}
}
also create a class to get all languages
public class Loc {
protected Locale locale;
public Loc(String ietfLanguageTag) {
this.locale = null;
String[] l = ietfLanguageTag.split("_");
if (l.length == 2) {
this.locale = new Locale(l[0], l[1]);
}
}
public String oneLineLanguageCountry() {
return String.format("%s (%s)", new Object[]{toTitleCase(this.locale.getDisplayLanguage(this.locale)), toTitleCase(this.locale.getDisplayCountry(this.locale))});
}
public String twoLinesLanguageCountry() {
return String.format("%s\n%s", new Object[]{toTitleCase(this.locale.getDisplayLanguage(this.locale)), toTitleCase(this.locale.getDisplayCountry(this.locale))});
}
public String getIetfLanguageTag() {
return String.format("%s_%s", new Object[]{this.locale.getLanguage(), this.locale.getCountry()});
}
public Locale getLocale() {
return this.locale;
}
private static String toTitleCase(String s) {
return s.length() == 0 ? s : new StringBuilder(String.valueOf(Character.toUpperCase(s.charAt(0)))).append(s.substring(1)).toString();
}
public boolean isLocaleCurrentLocale() {
return Locale.getDefault().equals(getLocale());
}
public String toString() {
return oneLineLanguageCountry();
}
}
please vote my answer if it worked for you too