Android 倒计时的实现
2013-12-12 11:02
92 查看
该方法参考了以下文章
http://blog.csdn.net/ithomer/article/details/6903084
http://blog.csdn.net/ithomer/article/details/6903084
public class timerTask extends Activity{ private int recLen = 0; private TextView txtView; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.timertask); txtView = (TextView)findViewById(R.id.txttime); handler.postDelayed(runnable, 1000); } Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { recLen++; txtView.setText("" + recLen); handler.postDelayed(this, 1000); } }; }以下方法为自己整理的
CountDownTimer countDownTimer = new CountDownTimer(8000, 1000) { // millisUntilFinished:表示剩余的时间 @Override public void onTick(long millisUntilFinished) { textView1.setText("seconds remaining: " + millisUntilFinished / 1000 + 1); } // 计时结束时的操作 @Override public void onFinish() { textView1.setText("Bomb !!!!!"); } }; countDownTimer.start();
相关文章推荐
- Android实现计时与倒计时(限时抢购)的几种方法(线程)
- Android---验证码倒计时的简单实现
- Android获取验证码倒计时功能(Timer实现)
- Android利用CountDownTimer类实现倒计时功能
- Android利用CountDownTimer实现验证码倒计时效果实例
- android倒计时功能的实现(CountDownTimer)
- Android倒计时+警报[最简单的实现方式]
- Android 倒计时功能的实现(CountDownTimer)
- 【Android工具类】验证码倒计时帮助类CountDownButtonHelper的实现
- Android利用RecyclerView实现列表倒计时
- android实现计时与倒计时(限时抢购)的几种方法(线程)
- Android利用CountDownTimer类实现倒计时功能
- Android -- 倒计时Button的几种实现
- Android实现文件上传和下载倒计时功能的圆形进度条
- Android实现计时与倒计时的几种方法(转)
- 【Android】倒计时功能简单实现及日期工具类分享
- Android自定义TimeButton实现倒计时按钮
- Android开发-03-倒计时功能的实现
- Android实现计时与倒计时(限时抢购)的几种方法
- Android中使用Handler以及CountDownTimer实现包含倒计时的闪屏页面