Ive been looking to see a method to see if a CountDownTimer is running or not, but I cant find a way to, any help would be greatly appreciated
if (position == 0) {
mCountDown = new CountDownTimer((300 * 1000), 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: "
+ millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("0:00");
String path = "/sdcard/Music/ZenPing.mp3";
try {
mp.reset();
mp.setDataSource(path);
mp.prepare();
mp.start();
} catch (IOException e) {
Log.v(getString(R.string.app_name),
e.getMessage());
}
}
}.start();
}
For that how can I check if mCountDown is currently running?
Just put a boolean
flag which indicate that by following code
boolean isRunning = false;
mCountDown = new CountDownTimer((300 * 1000), 1000) {
public void onTick(long millisUntilFinished) {
isRunning = true;
//rest of code
}
public void onFinish() {
isRunning= false;
//rest of code
}
}.start();