當前位置:首頁 » 安卓系統 » 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 瀏覽:762
如何提高三星a7安卓版本 發布:2024-09-20 08:42:35 瀏覽:661
如何更換伺服器網站 發布:2024-09-20 08:42:34 瀏覽:309
子彈演算法 發布:2024-09-20 08:41:55 瀏覽:286
手機版網易我的世界伺服器推薦 發布:2024-09-20 08:41:52 瀏覽:815
安卓x7怎麼邊打游戲邊看視頻 發布:2024-09-20 08:41:52 瀏覽:160
sql資料庫安全 發布:2024-09-20 08:31:32 瀏覽:91
蘋果連接id伺服器出錯是怎麼回事 發布:2024-09-20 08:01:07 瀏覽:505
編程鍵是什麼 發布:2024-09-20 07:52:47 瀏覽:655
學考密碼重置要求的證件是什麼 發布:2024-09-20 07:19:46 瀏覽:479