Question : stop countdown timer when exiting an activity
Answered by : smoggy-scarab-fjb1xnesz6be
@Override
public void onFinish() { val = 0; // When time finish go for mainActivity Intent intent = new Intent( second_five_questions_questions_1.this, second_five_questions_questions_2.class); intent.putExtra("key", val); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); cancel(); // add this to cancel out countdown finish();
}
Source : https://stackoverflow.com/questions/50335269/countdowntimer-not-stopped-after-moving-to-next-activity-quiz-application | Last Update : Mon, 25 Oct 21