📌  相关文章
📜  退出活动时停止倒数计时器 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:33.148000             🧑  作者: Mango

代码示例1
@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();
}