I'm creating a simple application in android studio, where I make a split and present its result in an EditText, however I'd like to present only two decimal places, what's the best way to do that?
I'm creating a simple application in android studio, where I make a split and present its result in an EditText, however I'd like to present only two decimal places, what's the best way to do that?
Use this code to format your decimal places in float or double
float x = (float) 12.309989;
DecimalFormat df = new DecimalFormat("0.00");
editText.setText(df.format(x));