Wednesday 27 June 2012

CountDownTimer in andriod


class timess extends CountDownTimer {
public timess(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
// TODO Auto-generated constructor stub
}

@Override
public void onFinish() {
// TODO Auto-generated method stub
Toast.makeText(getBaseContext(), "hello", 10000).show();
}
//on Tick method is call Every time
@Override
public void onTick(long millisUntilFinished) {
delay = delay + 1;
if (delay > 3) {
second = second + 1;
}
if (second == 60) {
minute = minute + 1;
second = 0;
}

// TODO Auto-generated method stub
}
}

How to call Countdown timmer class in activity...........


"timess" is the name of that class which is extend by countdowntimer 



timess tm = new timess(1000000000, 1000);
tm.start();



No comments:

Post a Comment