I have 3 fragments loaded with a ViewPager.
One of the fragments has a ProgressBar being updated like so:
cdt = new CountDownTimer(intDuration, 1000) { //(intDuration) milli seconds is total time, 1000 milli seconds is time interval
public void onTick(long millisUntilFinished) {
pb.setProgress(pb.getProgress() + 1);
}
public void onFinish() { }
}.start();
This works great until I swipe to another fragment, then of course the time stops.
How can I get the timer to continue to run while the fragment is not in focus, so that the ProgressBar is in the correct position when returning to the fragment?