title: How to connect a countdowntimer to a button
body: <p>I'm working with Android Studio. I'm creating an app that has a countdowntimer and a button. When I run the application, the timer automatically runs and if I want to click the button there is a TextView that counts how many times I press the button. I want the that timer starts when I press the button ,the countdown continue running and it stops at time "0:000" so it stops even the counting of clicks. Can you help me?
  (if it helps I put the code)</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      txtCount = (TextView)findViewById(R.id.textView1);
      txtCount.setText(String.valueOf(count));
      btnCount = (Button)findViewById(R.id.button1);
      final TextView textViewTimer = (TextView)findViewById(R.id.textView2);
      btnCount.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              count++;
              txtCount.setText(String.valueOf(count));
          }
  
      });
      new CountDownTimer(10000, 1) {
          public void onTick(long millisUntilFinished) {
              textViewTimer.setText("" + millisUntilFinished / 1000
                      + ":" + millisUntilFinished % 1000);
          }
  
          public void onFinish() {
              textViewTimer.setText("0:000");
          }
      }.start();
  
  
  }
  </code></pre>
  
  <p>I don't write the rest of the code of other things for privacy, but this is the interested part ;)</p>