android – 如何避免双重科学符号?

这是我的简单代码
@Override
    public void onClick(View v) {
        try {
            double price = Double.parseDouble(ePrice.getText().toString());
            double percent = Double.parseDouble(ePercent.getText().toString());

            double priceValue = price * percent/100.0f;
            double percentValue = price - priceValue;

            moneyToGet.setText(String.valueOf(priceValue));
            moneyToPay.setText(String.valueOf(percentValue));

            moneyToGet.setText("" + priceValue);
            moneyToPay.setText("" + percentValue);

            // catch
        } catch (NumberFormatException ex) {
            // write a message to users
            moneyToGet.setText("");
        }
    }

});

这是百分比计算器的简单代码.

我想要的是避免在我的计算器中的科学符号,因为我不想向用户解释什么是科学符号.

例如,如果我想要计算100,000,000和削减50%,它应该给我50,000这是给我5.0E7在我的情况下,没有为用户任何场景.当然我知道这两个结果是正确的.
提前致谢.

解决方法

检查答案 here.你可以写
moneyToGet.setText(String.format("%.0f",priceValue));

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...