You might have something like the code below in your app to start your countdown timer.
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("done!");
}
}.start();
You could wrap an if statement around that to see if the countdown has started or not, if it has then set a boolean to true and if not set it to false (since the timer has stopped).
if(countDownStarted == false)
{
new CountDownTimer(30000, 1000)
{
public void onTick(long millisUntilFinished)
{
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
countDownStarted = true;
}
public void onFinish()
{
mTextField.setText("done!");
countDownStarted = false;
}
}.start();
}