android 获取系统语言

来源:互联网 发布:内网怎么访问阿里云 编辑:程序博客网 时间:2024/06/04 19:37

使用getLanguage()方法和getCountry方法,获取系统设置的语言和区域。


//获取系统当前使用的语言String lan = Locale.getDefault().getLanguage();//获取区域String country = Locale.getDefault().getCountry();//设置成简体中文的时候,getLanguage()返回的是zh,getCountry()返回的是cn.

贴上getDefault()方法的api说明:

Locale java.util.Locale.getDefault()

public static Locale getDefault ()

Since: API Level 1

Returns the user's preferred locale. This may have been overridden for this process withsetDefault(Locale).

Since the user's locale changes dynamically, avoid caching this value. Instead, use this method to look it up for each use. 


贴上一个查询语言代号的网址:

http://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx

原创粉丝点击