I have an app (SDK 1.1)  that uses

 dataOut_str = String.format("%.2f" ,dataOut_d);

which converts correctly double (dataOut_d) into a string with 2
decimals.

With 1.5, I get a runtime exception:

08-09 17:36:45.717: ERROR/AndroidRuntime(944): Uncaught handler:
thread main exiting due to uncaught exception
08-09 17:36:45.727: ERROR/AndroidRuntime(944):
java.util.IllegalFormatConversionException: f is incompatible with
java.lang.String
08-09 17:36:45.727: ERROR/AndroidRuntime(944):     at
java.util.Formatter$Transformer.transformFromFloat(Formatter.java:
1919)

Instead I use dataOut_str = Double.toString(dataOut_d);
and have to add additional code to display only 2 decimals.

1. Has anything changed between 1.1 and 1.5?
2. Is there a better way of doing this?

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to