Possible Duplicate:
How do I format a number in java?
String.format() to format double in java
I want to be able to take the output from a double variable (called double) and put it in a TextView along with some String text (called outputPref, which just contains "cubic mm") like below
displayAnswer.setText(volume + " " + outputPref);
This works fine, however, the number shows in the TextView as the full double (with many, many decimal places). I want the number to show with comma's splitting the thousands (if there are any) with one decimal place, like the Excel number format "(* #,##0.0);(* (#,##0.0);(* "-"??);(@_)", or put simply (given I won't have any negative numbers) "#,##0.0"
What is the function I should use to reconfigure the volume double variable before applying it to the TextView?