获得手机系统设置的区域
通过Locate这个类,我们可以获得手机系统设置的区域:java.util.Locale
Locale represents a language/country/variant combination. It is an identifier which dictates particular conventions for the presentation of information. The language codes are two letter lowercase codes as defined by ISO-639. The country codes are three letter uppercase codes as defined by ISO-3166. The variant codes are unspecified.
若手机系统设置的区域为美国
// Locale.getISOCountries()显示[Ljava.lang.String;@435a0af0
System.out.println(Locale.getISOCountries());
//Locale.getISOLanguages()显示[Ljava.lang.String;@435a46d0
System.out.println(Locale.getISOLanguages());
//Locale.getDefault()获得Locate
//Locale.getDefault().getCountry()显示US
System.out.println(Locale.getDefault().getCountry());
//Locale.getDefault().getDisplayCountry()显示Unite State
System.out.println(Locale.getDefault().getDisplayCountry());
//Locale.getDefault().getDisplayLanguage()显示English
System.out.println(Locale.getDefault().getDisplayLanguage());