Rounding numbers on Android

Asked

Viewed 420 times

0

I am wanting to format numbering to only two decimal places after the comma, I am using the following code line

NumberFormat formato = new DecimalFormat("0.00");

But my application’s minimum API is 15 and it’s asking 24 to use this class, does anyone know any other way to round and format numbering?

1 answer

1


You’re probably using the class android.icu.text.NumberFormat which is API 24. Go to imports and switch to java.text.NumberFormat. The memo to the DecimalFormat: java.text.DecimalFormat.

  • Man, thank you very much, how inattentive of me, thank you very much!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.