【问题标题】:Android Currency Display: Device vs. EmulatorAndroid 货币显示:设备与模拟器
【发布时间】:2011-02-07 21:59:30
【问题描述】:

在我的程序中,我有一个部分使用 java NumberFormat 显示各种货币。例如,以下三行将为您提供阿尔及利亚的货币格式。

chosenlocale = new Locale("ar","DZ");

NumberFormat currencyformatter = NumberFormat.getCurrencyInstance(chosenlocale);

String currencyexample = currencyformatter.format(Double.parseDouble("0000.00000"));

当我在 Android 模拟器中运行它时,我得到了很酷和时髦的字符,但是当我在我的设备上运行它时却没有。我假设如果该设备是阿尔及利亚的本地设备,则字符将像在模拟器中一样显示。我的假设是否正确?

非常感谢您的意见!

【问题讨论】:

    标签: java android android-emulator currency


    【解决方案1】:

    你的假设是正确的。

    在您的 android 设备上,您可以设置一个选项,让您使用模拟区域设置(定义 -> 应用程序 -> 开发),您甚至可以为您的设备定义另一个位置(定义 -> 区域和文本 -> 选择区域)

    在您的应用中,您还可以为设备设置区域设置(不会更改系统配置)

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

    看看 setLocale(Locale locale)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-18
      • 2017-08-06
      • 2010-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-28
      • 2010-12-11
      相关资源
      最近更新 更多