• android 倒计时类


    public class CountdownTimerActivity extends Activity {
    private TimeCount time;
    private Button checking;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    time = new TimeCount(60000, 1000);//构造CountDownTimer对象
    
    time.start();
    checking = (Button) findViewById(R.id.button1);
    checking.setOnClickListener(this);
    }
    
    class TimeCount extends CountDownTimer {
    public TimeCount(long millisInFuture, long countDownInterval) {
    super(millisInFuture, countDownInterval);//参数依次为总时长,和计时的时间间隔
    }
    @Override
    public void onFinish() {//计时完毕时触发
    checking.setText("重新验证");
    checking.setClickable(true);
    }
    @Override
    public void onTick(long millisUntilFinished){//计时过程显示
    checking.setClickable(false);
    checking.setText(millisUntilFinished /1000+"秒");
    }
    }
    

      

  • 相关阅读:
    poj 1286
    poj 1815
    poj 3368
    十个利用矩阵乘法解决的经典题目
    poj 1026
    hdu 1394
    poj 3270
    poj 2154
    《重构 改善既有代码的设计》读书笔记2
    Android OpenGL ES: 渐变颜色的三角形
  • 原文地址:https://www.cnblogs.com/xiaoli3007/p/4270509.html
Copyright © 2020-2023  润新知