[android-developers] Re: How do I convert float to 2 decimal places?
Yeah, I use the NumberFormat:
NumberFormat numberFormat = DecimalFormat.getInstance();
numberFormat.setMaximumFractionDigits(2);
String formattedText = numberFormat.format(yourFloat);
On Aug 16, 11:13 am, "Maps.Huge.Info (Maps API Guru)"
<cor...@gmail.com> wrote:
> Do you want to round or display it as text?
>
> Try looking up java.text.DecimalFormat if you want text.
>
> -John Coryat
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home