Arrêtez le compte à rebours lors de la sortie d'une activité

@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();
}
Smoggy Scarab