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

标签 android locale

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

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/

相关文章:

c - 同时使用代码页 437 和 setlocale

winapi - 如何使用FormatMessage C++获取仅英文消息

android - 解析facebook登录空指针异常

android - 如何判断 GPS 是否可用?另外,如何根据 GPS 坐标确定城市/州/国家?

android - 在 Android 中以编程方式更改应用程序中的语言

c - Linux 和 C 编程 : How can I write utf-8 encoded text to a file?

android - 在 Activity 之间传递数据 - Android SDK

android - Android 上的 Google 日历 API 访问 token

android - 在 Galaxy Tab 中自动连接到 Debug模式

c - postgresql 的 Windows 安装错误。 make命令出错