Im displaying a negative amount in an Activity using
double value = -1.0;
NumberFormat defaultFormat = NumberFormat.getCurrencyInstance(Locale.US);
String formattedText = defaultFormat.format(value);
But when i run this on Samsung Galaxy S5 (Android 4.4.2)
I'm getting ($1.0)
where as Nexus 5 (Android 5.1.1)
gives it as -$1.0
.
What is the issue here ?
Thanks to @Bonati
public static String formatAmount(double value) {
NumberFormat numberFormat = new DecimalFormat("'$'0.00");
return numberFormat.format(value);
}
This works fine for me.