title: Adding lots of numbers?
body: <p>Hi I would like to ask something about my code coz I can't find out why is that It adds more than 1 when I declare it to add 1 everytime the timer reaches 0?</p>
  
  <p>here is my code</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_timer);
  
      timerView = (TextView)findViewById(R.id.timer);
      energyView = (TextView)findViewById(R.id.energy);
  
      counter = new MyCount (10000,10);
      counter.start();
  
  
  }
  
  public String formatTime(long millis) 
  {
      output = "";
      seconds = millis / 1000;
      long minutes = seconds / 60;
  
      seconds = seconds % 60;
      minutes = minutes % 60;
  
      String secondsD = String.valueOf(seconds);
      String minutesD = String.valueOf(minutes);
  
      if (seconds &lt; 10)
          secondsD = "0" + seconds;
      if (minutes &lt; 10)
          minutesD = "0" + minutes;
  
      output = minutesD + ":" + secondsD;
  
      return output;
  }
  public class MyCount extends CountDownTimer 
  {
      Context mContext;
  
      public MyCount(long millisInFuture, long countDownInterval) 
      {
          super(millisInFuture, countDownInterval);
      }
  
  
      public void onTick (long millisUntilFinished) 
      {
          timerView.setText ( formatTime(millisUntilFinished));
  
          if ( seconds == 0 )
          {
  
              Toast.makeText( getApplicationContext(), "Done", Toast.LENGTH_LONG ).show();
              energy = energy + 1;
              energyView.setText(Integer.toString(energy));
          }
      }
  
      public void onFinish() {}
  
  }
  </code></pre>
  
  <p>My energyView is always showing random number but mostly 40+ everytime my seconds reaches 0 can anyone help me? thanks in advance</p>