my code never enters onchronometertick method. doing incorrectly? need set tick time somehow? can't figure out way that.
elapsedtimer.setonchronometerticklistener(new chronometer.onchronometerticklistener() { @override public void onchronometertick(chronometer chronometer) { countup[0] = (systemclock.elapsedrealtime() - chronometer.getbase()) / 1000; elapsedtimedynamic.settext("" + countup); } }); elapsedtimer.start();
for in future having trouble using chronometer elapsed timer/stopwatch , can't figure out, ended scrapping chronometer , using countdowntimer, using in such way count up:
final long starttime = system.currenttimemillis(); elapsedtimer = new countdowntimer(activitytime + 1000, 100) { @override public void ontick(long l) { long elapsedtime = system.currenttimemillis() - starttime; elapsedtime = elapsedtime/1000; elapsedtimetextview.settext(string.format("%02d", (elapsedtime))); } @override public void onfinish() { } }.start();
Comments
Post a Comment