cancelling and restarting CountDownTimer issue
<p>Hi I am having a problem with CountDownTimer function</p>

<p>first I can get it to stop counting down with the counter.cancel();
then I store the milliUntilFinished value in countercur.</p>

<p>then I restart the timer using that stored countercur value.
This all works fine. but when I try to cancel a 2nd time, it never stops the timer anymore.
just works once, am I missing something? here is my code Thanks:</p>

<pre><code>// Main code :
MyCount counter = new MyCount(59000, 1000);
            counter.start(); // start timer at 59 seconds

///

button1.setOnClickListener(new View.OnClickListener() { 


    public void onClick(View v) {
counter.cancel(); // -- &gt; cancelling the timer works here, the clock stops ok
//
// rest of code snipped

button2.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) {
      MyCount counter= new MyCount(countcur,1000); // countcur is the current counter value when last cancelled

           counter.start(); // This restarts timer ok. when when retrying button 1 to cancel again, it never cancels.

// rest of code snipped

// Timer Setup
    public class MyCount extends CountDownTimer {

        public MyCount(long millisInFuture, long countDownInterval) {

        super(millisInFuture, countDownInterval);
        }    
        public void onFinish() {
Intent intent = new Intent(); 
            intent.setClass(Main.this, Final.class);
            startActivity(intent);
            }
            else {
            MyCount counter = new MyCount(59000, 1000);
            counter.start();
            clock = counter.toString();
            }

        }    
        public void onTick(long millisUntilFinished) {
            //int min = 5;
            /*if (+millisUntilFinished / 1000 &lt;= 240) {
                min = 4;
                mintosec = "240";

                //millisUntilFinished = 59000;
            }
            else if (+millisUntilFinished / 1000 &lt;= 180) {
                min = 3;
                mintosec = "180"; }
            else if (+millisUntilFinished / 1000 &lt;= 120) {
                min = 2;
                mintosec = "120"; }
            else if (+millisUntilFinished / 1000 &lt;= 60)
                min =1;
                mintosec = "60"; */

            //TextView totmin = (TextView) findViewById(R.id.clockmin);
            //totmin.setText("");
            TextView totsec = (TextView) findViewById(R.id.clocksec);
            totsec.setText(+duration +" : "+ millisUntilFinished / 1000);
            countcur = millisUntilFinished; // store current count value for pausing and restarting
        }
    }  // End Timer
</code></pre>
