Android: String format with Double value
%.0f is the format string for a float, with 0 decimal places.
The values you're passing to String.format are String, String when it needs to be Double, Double.
You do not need to convert the doubles to strings.
String headerText = String.format("%.0f kg / %.0f lbs", dWeightInKg, dWeightInLbs);
This should work,
DecimalFormat df = new DecimalFormat("#.##");private String convertToFormat(double value){ return df.format(value);}
You don't need the Double.ToString() since your formatter is already expecting a number. Try this:
String headerText = String.format("%.0f kg / %.0f lbs", dWeightInKg , dWeightInLbs);