Android: Get the value of CountDown Timer for pause and resume like a scoreboard
<p>I am working on a project and the last thing I need to do is to pause the countdown<br>
timer and resume it as it is like a timer in a scoreboard. I am confused on how to do<br>
it for I only have studied android and java for 2 weeks so I am bit new in this<br>
programming.  </p>

<p>I want to get the value of the Count down timer as counter.cancel(); and pass it to<br>
value e.g. current time to solve for the remaining time so that I would know what to<br>
put in millisuntilfinished in ontick(long milisuntilfinished). Some say I should use<br>
savedInstanceState but Im really confused on how to apply it. Please help. I'm bit<br>
rushed about this project. I am only an intern assigned to create a scoreboard android<br>
app and I don't have much background regarding Java as well as in Android programming.  </p>

<p>This is my code:  </p>

<pre><code>Timer.setOnClickListener(TimerClickListener);  

counter = new MyCount(600000, 1000);  

private OnClickListener TimerClickListener = new OnClickListener() {  
    public void onClick(View v) {  
        if (p1&lt;=4){  
            if (decision==0) {  
                counter.start();  
                decision=1;
            }  
            else if(decision==2) {  
                //resume  
                counter.onResume1();            
                decision=1; 
            }  
            else {  
                //pause  
                counter.onPause1();  
                decision=2; 
           }//end if  
        }      
     }  
  };    

class MyCount extends CountDownTimer {  
    public MyCount(long millisInFuture, long countDownInterval) {  
        super(millisInFuture, countDownInterval);  
    }//MyCount  

    public void onResume1(){  
        onResume(); 
    }  

    public void onPause1() {  
        onPause();
    }  

    public void onFinish() {  
        Timer.setText("00:00");  
        p1++;  
        if (p1&lt;=4) {  
            TextView PScore = (TextView) findViewById(R.id.pscore);  
            PScore.setText(p1 + "");  
        } //end if  
    }//finish  

    public void onTick(long millisUntilFinished) {  
        Integer milisec = new Integer(new   Double(millisUntilFinished).intValue());  
        Integer cd_secs = milisec / 1000;                  
        minutes = (cd_secs % 3600) / 60;  
        seconds = (cd_secs % 3600) % 60;                   
        Timer.setText(String.format("%02d",  minutes) + ":"  
        + String.format("%02d", seconds));  
        //long timeLeft = millisUntilFinished / 1000;  
    }//on tick  

}//class MyCount  
</code></pre>
