当前位置:首页 » 安卓系统 » android获取系统语言

android获取系统语言

发布时间: 2022-01-12 20:24:23

⑴ 如何实现Android切换系统语言功能

如果想获取手机的当前系统语言,可以通过Locale类获取,主要方法:Locale.getDefault().getLanguage(),返回的是es或者zh;通过Locale.getDefault().getCountry()获取当前国家或地区,返回为CN或US;如果当前手机设置为中文-中国,则使用此方法返回zh-CN,同理可得到其他语言与地区的信息。 查看原帖>>

⑵ 为Android系统中自己添加语言怎样操作

1.首先你在settings中出现阿拉伯语的选项了表示你在build/target/proct/language-full.mk里添加了的PRODUCT-LOCALES:=ar-EG
2.在packages/apps/settings/res/下面添加values-ar和values-ar-nokeys(这些文件你的自己去找天添加进去)
3.packages/apps/settings/tests/res/下添加values-ar 4.frameworks/base/core/res/res/下添加values-ar 这就好了注意:我让你添加的文件下你可以去源码中下载 看有没有,我在Android-2.3.7中找到的

⑶ 如何在android APP中设置系统语言

android APP中设置系统语言可以通过反射机制。

private void updateLanguage(Locale locale) {
try {
Object objIActMag, objActMagNative;
Class clzIActMag = Class.forName("android.app.IActivityManager");
Class clzActMagNative = Class.forName("android.app.ActivityManagerNative");
Method mtdActMagNative$getDefault = clzActMagNative.getDeclaredMethod("getDefault");
// IActivityManager iActMag = ActivityManagerNative.getDefault();
objIActMag = mtdActMagNative$getDefault.invoke(clzActMagNative);
// Configuration config = iActMag.getConfiguration();
Method mtdIActMag$getConfiguration = clzIActMag.getDeclaredMethod("getConfiguration");
Configuration config = (Configuration) mtdIActMag$getConfiguration.invoke(objIActMag);
config.locale = locale;
// iActMag.updateConfiguration(config);
// 此处需要声明权限:android.permission.CHANGE_CONFIGURATION
// 会重新调用 onCreate();
Class[] clzParams = { Configuration.class };
Method mtdIActMag$updateConfiguration = clzIActMag.getDeclaredMethod(
"updateConfiguration", clzParams);
mtdIActMag$updateConfiguration.invoke(objIActMag, config);
} catch (Exception e) {
e.printStackTrace();
}
}

⑷ Android切换系统语言会做哪些操作

activity确实已经不存在了,所以报了这个错误。它是这样执行的:1、我的应用已经启动,我按下HOME键,执行了onPause()——>onStop();2、我在设置里面切换了系统语言,无任何反应。3、再次点击我的应用,连续执行了onDestroy()——>onCreate()——>onStart()——>onResume()——>onPause()——>onStop()——>onDestroy()。所以就出现了这两种现象:1、有初始化dialog的界面时报了上面这个错误。2、没有dialog的界面时就像进不去一样,其实已经onDstroy()了。正常情况它应该是执行到onResume()的,但是可能有哪些原因会导致它继续往下执行,一直到onDestroy()呢?
到DEVDIV.COM网站查看回答详情>>

⑸ android手机的系统语言切换

我也遇到了相似的情况,网上找了4个小时,本来想刷机的,可是不会,最后发现了morelocale2这个手机软件,能在语言设置里变出几十个选项,包括中文……幸好没有刷机

⑹ android判断当前系统用的是什么语言

判断国家:
中文:getResources().getConfiguration().locale.getCountry().equals("CN")
繁体中文: getResources().getConfiguration().locale.getCountry().equals("TW")
英文(英式):getResources().getConfiguration().locale.getCountry().equals("UK")
英文(美式):getResources().getConfiguration().locale.getCountry().equals("US")

如果不清楚当前国家的简写,可以直接System.out(getResources().getConfiguration().locale.getCountry());打印出来即可

⑺ android手机怎么提取系统语言标识

Android--获取当前系统的语言环境其代码如下:

private boolean isZh() {
Locale locale = getResources().getConfiguration().locale;
String language = locale.getLanguage();
if (language.endsWith("zh"))
return true;
else
return false;
}

其中languag为语言码:
zh:汉语
en:英语

⑻ android 怎样获取当前语言的设置

如果想获取手机的当前系统语言,可以通过Locale类获取,主要方法:Locale.getDefault().getLanguage(),返回的是es或者zh;通过Locale.getDefault().getCountry()获取当前国家或地区,返回为CN或US;如果当前手机设置为中文-中国,则使用此方法...

⑼ android 如何获取系统当前语言

Android--获取当前系统的语言环境其代码如下:

private boolean isZh() {
Locale locale = getResources().getConfiguration().locale;
String language = locale.getLanguage();
if (language.endsWith("zh"))
return true;
else
return false;
}

其中languag为语言码:
zh:汉语
en:英语

热点内容
单片机android 发布:2024-09-20 09:07:24 浏览:765
如何提高三星a7安卓版本 发布:2024-09-20 08:42:35 浏览:664
如何更换服务器网站 发布:2024-09-20 08:42:34 浏览:311
子弹算法 发布:2024-09-20 08:41:55 浏览:289
手机版网易我的世界服务器推荐 发布:2024-09-20 08:41:52 浏览:817
安卓x7怎么边打游戏边看视频 发布:2024-09-20 08:41:52 浏览:162
sql数据库安全 发布:2024-09-20 08:31:32 浏览:94
苹果连接id服务器出错是怎么回事 发布:2024-09-20 08:01:07 浏览:507
编程键是什么 发布:2024-09-20 07:52:47 浏览:658
学考密码重置要求的证件是什么 发布:2024-09-20 07:19:46 浏览:481