title: How to implement two countdown timers alternatively in Android
body: <p>I have implemented one counter and onFinish() of first counter,I started second counter but the first counter not able to finish.Text "Bye Guyz" remain for some time so how to finish the text.</p>
  
  <p>Please help me.</p>
  
  <p>Thanks in advance.!!!</p>
  
  <p><strong>Code :-</strong></p>
  
  <pre><code>counter= new CountDownTimer(10000, 1000) {
  
                  public void onTick(long millisUntilFinished) {
                      if (count == 0) {
                          tv.setText("First counter");
                          tv2.setVisibility(View.VISIBLE);
                          tv2.setText("Hello Guyz");
                      }
                  }
  
                  public void onFinish() {
                      if(!flag) {
                          tv2.setText("Bye Guyz");
                          count = 0;
                          try {
                              counter.cancel();
                          }catch (Exception e){}
                      }
                      else if(flag) {
                         counter1 = new CountDownTimer(9000, 1000) {
                              public void onTick(long millisUntilFinished) {
                                  flag = false;
                                  tv.setText("Second counter");
                          tv2.setVisibility(View.VISIBLE);
                          tv2.setText("Hello Girls");
                                  count = 0;
                              }
  
                              public void onFinish() {
                                  tv2.setVisibility(View.VISIBLE);
                                  tv2.setText("Bye Girls");
                                  count = 0;
                              }
                          }.start();
  </code></pre>