【发布时间】:2013-04-26 08:50:28
【问题描述】:
在我的应用程序中,我限制用户输入 7.2 位数字(如 1234567.12)。输入时应显示为 1,234,567.12。但它必须在数据库中保存为 1234567.12。我使用十进制格式为“### ,###.##" 显示在编辑文本框中。但是使用浮点数解析时出错,同时保存在数据库中。请告诉我任何建议。
关于格式化,我正在使用这个格式化程序 _decimalFormat =new DecimalFormat("###,###,###.##");
_decimalFormat.setMinimumFractionDigits(2);
_decimalFormat.setMaximumFractionDigits(2);
在 ontextChanged 监听器中,保存在数据库中时,我在这一行中遇到错误 [amountText2.setText(Float.parseFloat(amountText1.getText().toString()));]
【问题讨论】:
-
你的代码是什么?你的错误是什么?
标签: android android-edittext number-formatting