Search This Blog

Thursday, October 4, 2012

passing the Double values to the String

result = number1/number2
String stringdouble= Double.toString(result);
textview1.setText(stringdouble));


or you can use the nuberformate also.


Double result = number1/number2;
NumberFormat nm = NumberFormat.getNumberInstance();
textview1.setText(nm.format(result));



For 3 decimal digit
private static DecimalFormat REAL_FORMATTER = new DecimalFormat("0.###");
textview1.setText(REAL_FORMATTER.format(result));