0

I try this way to display it.

DecimalFormat REAL_FORMATTER = new DecimalFormat("0.0###############");
double value = 691 / 3600000;
textView1.setText(REAL_FORMATTER.format(value));

What's the problem?

  1. All the time TextView shows: 0,0. I thought it should be 0,000191944.
  2. This solve may cause problem with number biger than 10. I need display double value and I don't know how do it.
detector
  • 35
  • 8

1 Answers1

1

When dividing in Java the default value is int. You can try dividing using this way:

 double value = 691 /3600000D
 double value = (double)691/3600000;

or when divided with two places precision:

 double value = 691.0/36.0      
detector
  • 35
  • 8