title: Android, how to pass Double Value to Textview without getting infinity displayed?
body: <p><em>Short form: I try to hand over a Double Value to a textView with Double.toString but the textView always show "Infinity" instead of the true Value. When there is some Value if it's empty it shows 0.0.</em></p>
  
  <p>underneath i tried to explain how my app is build (constructed)</p>
  
  <p>Classes:</p>
  
  <pre><code>MainActivity.java
  FirstFragment.java
  SecondFragment.java
  Calculator.java
  </code></pre>
  
  <p>Layouts:</p>
  
  <pre><code>first_frag.xml
  second_frag.xml
  </code></pre>
  
  <p>to make it easier to understand i don't post the whole code, because that would be a lot!</p>
  
  <p>Basically i'm struggling at this Section in the SecondFragment.java:</p>
  
  <pre><code>public void fragmentBecameVisible() {
      String alcLevel = Double.toString(calc.getCurrentLevel());
      txtAlcLvl.setText(alcLevel);
  }
  </code></pre>
  
  <p>Calculator.java:</p>
  
  <pre><code>public double getCurrentLevel(){
      double alcTotal = 0.0;
  
      if (consumption.size() &gt; 0){
          alcHigh = consumption.get(0).getAlcTotal()/person.getDistribution();
          for (int i = 0; i &lt; consumption.size()-1; i++){
              alcTotal += consumption.get(i).getAlcTotal()/person.getDistribution()
                      -(consumption.get(i+1).getDrinkTime()-consumption.get(i).getDrinkTime())*0.15/3;
              if (alcTotal &lt; 0){
                  alcTotal = 0.0;
              }
              if (alcHigh &lt; (alcTotal + consumption.get(i+1).getAlcTotal()/person.getDistribution())){
                  alcHigh = alcTotal + consumption.get(i+1).getAlcTotal()/person.getDistribution();
              }
          }
          alcTotal += consumption.get(consumption.size()-1).getAlcTotal()/person.getDistribution()
                  -(consumption.get(consumption.size()-1).getTime()-consumption.get(consumption.size()-1).getDrinkTime())*0.15/3;
  
          if (alcTotal &lt; 0){
              alcTotal = 0.0;
          }
          return alcTotal;
      }else{
          return 0.0;
      }
  }
  </code></pre>
  
  <p>while you don't have to understand the whole math behind, it's just about the fact, that the textView from second_frag.xml:</p>
  
  <pre><code>            &lt;TextView
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:text="New Text"
              android:id="@+id/txtAlcLvl" /&gt;
  </code></pre>
  
  <p><strong>does not show the correct Double Value, instead it shows "Infinity"</strong></p>
  
  <p>I have the exact same code in Eclipse but somehow there it works just fine.</p>
  
  <p>Normally i would say, i made some stupid little failure somewhere but actually i can't find it for over an hour now, maybe someone could help, would appreciate it.</p>