title: Android: CountDownTimer skips last onTick()!
body: <p>Code: </p>
  
  <blockquote>
  <pre><code>public class SMH extends Activity {  
  
      public void onCreate(Bundle b) {  
          super.onCreate(b);  
          setContentView(R.layout.main);  
  
          TextView tv = (TextView) findViewById(R.id.tv);  
  
          new CountDownTimer(10000, 2000) {  
              public void onTick(long m) {  
                 long sec = m/1000+1;  
                 tv.append(sec+" seconds remain\n");  
              }  
              public void onFinish() {  
                 tv.append("Done!");  
              }  
          }.start();  
     }
  </code></pre>
  </blockquote>
  
  <p>Output:<br>
      10 seconds remain<br>
      8 seconds remain<br>
      6 seconds remain<br>
      4 seconds remain<br>
      Done! </p>
  
  <p>Problem:  </p>
  
  <p>How do I get it to show "<em>2 seconds remain</em>"? The time elapsed is indeed 10 seconds, but the last onTick() never happens. If I change the second parameter from 2000 to 1000, then this is the output:  </p>
  
  <p>10 seconds remain<br>
  9 seconds remain<br>
  8 seconds remain<br>
  7 seconds remain<br>
  6 seconds remain<br>
  5 seconds remain<br>
  4 seconds remain<br>
  3 seconds remain<br>
  2 seconds remain<br>
  Done!  </p>
  
  <p>So you see, it seems to be skipping that last onTick() call. And btw, the XML file is basically the default main.xml with the TextView assigned the id <em>tv</em> and the text set to "".</p>