title: Create a simple timer in a game
body: <p>I would be very grateful if someone could explain how to create a simple timer in a game which starts off at 30 seconds and then goes back until 0. At  0 I would then stop the game and invoke a method which would allow the next player to take a turn.</p>
  
  <p>Any advice would be appreciated. Thanks</p>
  
  <p><em>Edit:</em></p>
  
  <pre><code>import android.os.CountDownTimer;
  import android.widget.TextView;
  
  public class MyCount extends CountDownTimer {
      static TextView timeDisplay;
  
      public MyCount(long millisInFuture, long countDownInterval) {
          super(millisInFuture, countDownInterval);
      }
  
      public void onFinish() {
          timeDisplay.setText("Done!");
      }
  
      public void onTick(long millisUntilFinished) {
          timeDisplay.setText("Left: " + millisUntilFinished / 1000);
      }
  }
  </code></pre>
  
  <p>In a seperate class I have created a method:</p>
  
  <pre><code>public void setTimer() { 
      timeDisplay = new TextView(this);
      this.setContentView(timeDisplay);
      MyCount counter = new MyCount(30000, 1000);
      counter.start();
  }
  </code></pre>
  
  <p>Within an onClick method I have called the method above:</p>
  
  <pre><code>public void onClick(View v) {
      setTimer();
  }
  </code></pre>
  
  <p>I'd appreciate any advice on this. </p>