java - display seconds counting down in textview Android -
i have timer has set number of seconds count down way 0 if put 5 textview label want show 5,4,3,2,1,0, have timer stop. pass in random number selected user pass variable s timer
my textview:
mseconds = (textview)findviewbyid(r.id.secondslabel);
my timer:
int s = //int taken on spinner in class timer timer = new timer(); timer.schedule(new timertask() { @override public void run() { finish(); } }, s * 1000);
so when put mseconds.settext(//what should add here);
show number counting down 0
please check countdown timer:
http://developer.android.com/reference/android/os/countdowntimer.html
new countdowntimer(30000, 1000) { public void ontick(long millisuntilfinished) { mtextfield.settext("seconds remaining: " + millisuntilfinished / 1000); } public void onfinish() { mtextfield.settext("done!"); } }.start()
Comments
Post a Comment