I want to initiate a timer service when activity C is called now from activity C i can go to activity D and E but when the timer stopped then I want to redirect on activity A (Home Page), it doesn't matter which activity open after timer it may be C, D or E . i also want to show the left time in C, D, E activities
This kind of timer i want
// Timer to maintain session
new CountDownTimer(420 * 1000 + 1000, 1000) {
public void onTick(long millisUntilFinished) {
int seconds = (int) (millisUntilFinished / 1000);
int hours = seconds / (60 * 60);
int tempMint = (seconds - (hours * 60 * 60));
int minutes = tempMint / 60;
seconds = tempMint - (minutes * 60);
textView.setText(String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
}
public void onFinish() {
textView.setText("Completed");
}
}.start();