Answers for "stop countdown timer when exiting an activity"

0

stop countdown timer when exiting an activity

@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();
}
Posted by: Guest on October-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language