我正在製作一種應用程序,它使用兩種語言英語和烏爾都語。我有英文字符串的文件,我有字符串名稱When_undressing_arxml中的字符串標籤在api上創建了一些問題16
<string name="When_undressing_ar">بِسْمِ اللهِ</string>
,並有獨立的烏爾都語串XML進行烏爾都語語言,它具有字符串標籤作爲
<string name="لباس_اتارتے_وقت_کیا_پڑھیں_ar">بِسْمِ اللهِ</string>
,並通過調用字符串歌廳這些值
private static String getDuwaElement(String nameame, Context context) {
int duwaId = context.getResources().getIdentifier(name, "string", context.getPackageName());
return context.getString(duwaId);
}
當語言設置爲英語時,名稱爲「When_undressing_ar」。而名爲「لباس_اتارتے_وقت_کیا_پڑھیں_AR」當語言設置爲烏爾都語
這一切工作正常,給我所有的資源在兩種語言,
然而,當我試圖在API 22這個程序,它給不同的是資源未找到 。這個效果很好,直到api 16。請幫助是什麼原因造成這個問題,它提供了資源沒有發現異常
你不應該翻譯的字符串即名鍵= 「When_undressing_ar」。例如textview.setText(R.string.when_undressing_ar);如果設備語言是urdu,語言設置爲en和urdu資源將獲得en資源 –
我知道,我已經使用了它應該在urdu中的邏輯。我的問題是爲什麼這是給我的問題在更高的API然後16 – FaisalAhmed
什麼是你的urdu值的文件夾的名稱? –