import android.os.CountDownTimer;
MyCount timerCount;
public class TryCountdown extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
timerCount = new MyCount(5*1000, 1000); //倒數5秒
timerCount.start(); //開始倒數
public class MyCount extends CountDownTimer {
public MyCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
// 倒數結束時,會執行這裡
}
@Override
public void onTick(long millisUntilFinished) {
}
} // end of MyCount
}
2013年3月4日 星期一
[Android] 倒數計時器(countdown timer)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言