读秒 CountDownTimer

CountDownTimer timer = new CountDownTimer(5 * 1000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                tv.setText("还剩" + millisUntilFinished / 1000 + "秒");
            }

            @Override
            public void onFinish() {
                tv.setClickable(true);
                sp = getSharedPreferences("mensttuation", MODE_PRIVATE);
//                setHandler();
                Intent intent = new Intent();
                intent.setClass(StartActivity.this, sp.getBoolean("menstruation", false) ? MainActivity.class : SetMenstruationActivity.class);
                startActivity(intent);
                finish();
            }
        };
        timer.start();
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页