入力は次のようになり、次のよう8.7000000にフォーマットしたいと思います8.70 EUR。DecimalFormatクラスの使用を検討しました:
Double number = Double.valueOf(text);
DecimalFormat dec = new DecimalFormat("#.## EUR");
String credits = dec.format(number);
TextView tt = (TextView) findViewById(R.id.creditsView);
tt.setText(credits);
結果は8.7 EURです。の後に 2 桁の数字があるようにフォーマッタに指示するにはどうすればよい.ですか?