Wednesday, September 28, 2011

[android-developers] display countup timer with milliseconds

I'm trying to create a countup timer with milliseconds.
I used Chronometer but I don't know how to display milliseconds.

Chronometer crono = (Chronometer) findViewById(R.id.chrono);
startTime = SystemClock.elapsedRealtime();
crono.setOnChronometerTickListener(new
OnChronometerTickListener() {
public void onChronometerTick(Chronometer arg0) {
countUp = (SystemClock.elapsedRealtime() -
arg0.getBase()) / 1000;
countUp_milli = (SystemClock.elapsedRealtime() -
arg0.getBase());
String asText = (countUp / 60) + ":" + (countUp %
60);
timeflg.setText(asText);
}
});

crono.start();

please tell me how to display milliseconds.

Thank you

Hassy

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate