1

I am writing a small code to output a double variable using textview. However I am not able to control the number of decimals. Is there any way to control the number of decimals in textview.

code:

TextView temp;

temp = (TextView)findViewById(R.id.textView3);

double T = (3*(Math.pow(4,-1.2)));

temp.setText("Temperature ="+String.valueOf(T) + " deg C");

I wanted to print only four decimals in outputted textview.

Erwin
  • 4,729
  • 3
  • 30
  • 41
creator
  • 21
  • 2
  • I think your question was answered here: http://stackoverflow.com/questions/12783015/setting-custom-format-for-numbers-in-textview – Kristy Welsh Mar 19 '13 at 16:36

0 Answers0