title: restart a CountDownTimer
body: <p>With android studio I've an app with a <code>CountDownTimer</code>. It starts from 10 seconds to 0 when I press a button and a <code>TextView</code> that count how many clicks i do on a button,so far so good. I want to restart this activity all times i want by pressing another button restart. 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);
      btnRestart = (Button)findViewById(button2);
  
      final boolean[] timerProcessing = {false};
      final boolean[] timerStarts = {false};
  
      final TextView textViewTimer = (TextView)findViewById(R.id.textView2);
      //Saving link to timer object
      final CountDownTimer timer = new CountDownTimer(10000, 1) {
  
          public void onTick(long millisUntilFinished) {
              textViewTimer.setText("" + millisUntilFinished / 1000
                      + ":" + millisUntilFinished % 1000);
                          }
  
  
          public void onFinish() {
              textViewTimer.setText("0:000");
              timerProcessing[0] = false;
          }
  
      };
  
      btnCount.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              //start timer once when button first click
              if (!timerStarts[0]){
                  timer.start();
                  timerStarts[0] = true;
                  timerProcessing[0] = true;
              }
  
              if (timerProcessing[0]){
                  count++;
                  txtCount.setText(String.valueOf(count));
              }
          }
      });
      btnRestart.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {  }
  }
  </code></pre>