2011-07-11 26 views
0

根据当前语言,是否有解析xml文件的方法?例如,我有两个countries.xml文件。一个在values文件夹中,另一个在values-de文件夹中。我想解析特定于当前语言的文件。根据当前语言解析xml文件

非常感谢,

的Gratzi

+0

http://developer.android.com/reference/java/util/Locale.html –

回答

0

Android的环境分析这些文件给你,你可以通过不同的访问得到的数据,就像如果你有一组字符串在strings.xml ,您可以使用

getText(R.strings.my_string); 

这将为您提供该语言环境的strings.xml中的字符串(如果没有匹配,则为默认值)。

查看developer's guide on resource localization了解更多信息。