Android examples for Internationalization:Locale
get Default Language
//package com.java2s; import java.util.Locale; import android.content.Context; import android.content.res.Configuration; import android.provider.Settings; public class Main { public static final String UNKNOW = "Unknown"; public static final String[] getDefaultLang(Context context) { String[] result = { UNKNOW, UNKNOW }; Locale cLocale = getDefaultLocale(context); if (cLocale != null) { result[0] = cLocale.getCountry(); result[1] = cLocale.getLanguage(); }//www . ja v a 2 s. c om return result; } public static final Locale getDefaultLocale(Context context) { Locale result = null; try { Configuration localConfiguration = new Configuration(); Settings.System.getConfiguration(context.getContentResolver(), localConfiguration); if (localConfiguration != null) { result = localConfiguration.locale; } } catch (Exception localException) { } if (result == null) { result = Locale.getDefault(); } return result; } }