CountDownTimer官方介绍和使用
2015-08-19 11:03
375 查看
Class Overview
Schedule a countdown until a time in the future, with regular notifications on intervals along the way. Example of showing a 30 second countdown in a text field:上面的意思:安排一个倒计时器用于倒计时到未来的一个时间,在这个时间沿途中会间隔的定期通知你要做的时间。下面是展示的是30秒倒计时文本。
new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { mTextField.setText("done!"); } }.start();
The calls to
onTick(long)are
synchronized to this object so that one call to
onTick(long)won't
ever occur before the previous callback is complete. This is only relevant when the implementation of
onTick(long)takes
an amount of time to execute that is significant compared to the countdown interval.
上面的意思是,onTick的方法是对对象同步的,所以当这个上个onTick回调方法结束以后当前的onTick才起作用。onTick跟这个类唯一的相关是onTick的实现需要花大量的时间,这比倒计时Coutdown interval来说更加显著。
相关文章推荐
- 长连接
- 快捷键整理
- ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 的解决方法【转载】
- Redis安装与日常使用
- hadoop native
- 使用ffmpeg 对视频截图,和视频转换格式
- Android 高手进阶之自定义View,自定义属性(带进度的圆形进度条)
- [Android]RecyclerView的简单示例
- 数组笔记
- druid简单教程
- Oracle SQL性能优化
- Struts2拦截器篇(一)
- ubuntu 取色软件 Gpick
- 在windows添加视图
- 点击click事件在iPad没有响应
- extjs4 省市区选择器
- 关于ios注册推送
- Confluence+Crowd的集成(openLDAP认证)
- java.lang.OutOfMemoryError: PermGen space及其解决方法
- html5+css3 权威指南阅读笔记(三)---表单及其他新增和改良元素