How to pass double value to a textview in Android
In Android, assign a double to a textView:
Use Double.toString:
result = number1/number2 String stringdouble= Double.toString(result);textview1.setText(stringdouble));
or you can use the NumberFormat:
Double result = number1/number2;NumberFormat nm = NumberFormat.getNumberInstance();textview1.setText(nm.format(result));
To force for 3 units precision:
private static DecimalFormat REAL_FORMATTER = new DecimalFormat("0.###");textview1.setText(REAL_FORMATTER.format(result));