返回的字符串有什么区别吗:
Locale.getDefault().toString()
和
context.getResources().getConfiguration().locale.toString()
询问是因为我怀疑这会导致应用程序中出现错误,在使用 Locale.getDefault().toString()
之前有效的功能不再适用于 context.getResources()。 getConfiguration().locale.toString()
,在某些美国设备上。但不确定是否是这个原因。
谢谢!
最佳答案
Locale.getDefault().toString()
和
context.getResources().getConfiguration().locale.toString()
应该返回相同的值。
两者之间唯一的主要区别是 Locale.getDefault()
可以直接被 Locale.setDefault(locale)
覆盖. (这也会影响 context.getResources().getConfiguration().locale.toString()
)
关于android - 使用 Locale.getDefault() 和 context.getResources().getConfiguration().locale 的语言环境有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12051204/