android 计时器,倒计时

自己定义CountDownTimer

	/**
* 计时器
* @author Administrator
*
*/
class TimeCount extends CountDownTimer{ public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
} @Override
public void onFinish() { } @Override
public void onTick(long millisUntilFinished) {
//计时显示
if(millisUntilFinished/1000-1==0){ //倒计时技术在handler中进行处理 } tv_time.setText((millisUntilFinished/1000-1)+"s");//倒计时的时间显示 } }

调用

	private TimeCount time;//计时器
time=new TimeCount(60000,1000);//開始计时
time.start();
上一篇:android 77 fragment


下一篇:XML的四种解析器(dom_sax_jdom_dom4j)原理及性能比较[收藏]