How to make a milliseconds timer using chromometer?

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

How to make a milliseconds timer using chromometer?

Postby vaishumol » Sun Dec 19, 2010 9:53 am

Hi friends

Im using chronometer in my code. Its updating only for seconds, i would like to run a milliseconds using chronometer please help me, how to do that? here is my code

Code: Select all
mTimerCount
            .setOnChronometerTickListener(new OnChronometerTickListener() {

               public void onChronometerTick(Chronometer cm) {

                  long elapsedMillis = SystemClock.elapsedRealtime() - mTimerCount.getBase();           
                   Toast.makeText(Game.this, "Elapsed milliseconds: " + elapsedMillis,
                           Toast.LENGTH_SHORT).show();

                  timeCounter.setText(String.valueOf(totalTime));

               }

            });



How to show the milliseconds timer using chronometer?
vaishumol
Experienced Developer
Experienced Developer
 
Posts: 74
Joined: Sun Jan 03, 2010 6:33 am

Top

Re: How to make a milliseconds timer using chromometer?

Postby phix » Tue Dec 21, 2010 10:40 am

According to the docs ( http://developer.android.com/reference/ ... meter.html ) there's no mention of milliseconds. I would gather the class doesn't track that far down and you'd be better of using a different approach.
Posting questions without code is like going to the doctor and saying "it hurts, fix it."
phix
Master Developer
Master Developer
 
Posts: 230
Joined: Mon Mar 15, 2010 10:37 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 5 guests