Skip to content

Instantly share code, notes, and snippets.

@kuraydev
Last active March 26, 2020 08:36
Show Gist options
  • Select an option

  • Save kuraydev/031fe1813d4923e3b680 to your computer and use it in GitHub Desktop.

Select an option

Save kuraydev/031fe1813d4923e3b680 to your computer and use it in GitHub Desktop.
How to set a decimal value formatting into a TextView on Android? Article: https://freakycoder.com/android-notes-14-decimal-value-formatting-31cbb6a3466e
// Float and double is working with this code
float average = 9.333333333f;
double average_d = 9.55555555;
tv.setText(new DecimalFormat("##.##").format(average));
tv.setText(new DecimalFormat("##.##").format(average_d));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment