使用Locale.getDefault()和context.getResources()的语言环境有什么区别.getConfiguration()。locale?

时间:2012-08-21 08:46:07

标签: android locale

返回的字符串之间有什么区别:

Locale.getDefault().toString()

context.getResources().getConfiguration().locale.toString()

要求,因为我怀疑这会导致应用中的错误,在使用Locale.getDefault().toString()之前工作的某些内容在某些美国设备上不再与context.getResources().getConfiguration().locale.toString()一起使用。但不确定这是否是原因。

谢谢!

1 个答案:

答案 0 :(得分:3)

Locale.getDefault().toString()context.getResources().getConfiguration().locale.toString()应返回相同的值。

两者之间唯一的主要区别是Locale.getDefault()可以直接覆盖Locale.setDefault(locale)。 (这也会影响context.getResources().getConfiguration().locale.toString()

相关问题