I'm going to create a German currency format in Android, I just can't get the thousand, million, separator work. This is what I did so far:
String bill_subtotal = String.format("%.2f", bill_amount);
txtSubtotal = (TextView) findViewById(R.id.txtSubtotal);
txtSubtotal.setText(String.valueOf(bill_subtotal).replace(',', '.'));
Those above only make values like this: 60000.50 into 60000,50
I want to make it 60.000,50
Is there a way to make it like that?
My solution is ,
public static String formatGermanCurrency(double number) {
NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY);
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
return nf.format(number);
}