What I want is to measure time with milliseconds, but using Chronometer has the problem that it has no accuracy (its most resolution is seconds) I've seen this: Show miliseconds with Android Chronometer But I haven't been able to make it work. Maybe I should use another Object? Any idea?
Asked
Active
Viewed 5,901 times
1
-
[Show miliseconds with Android Chronometer](http://stackoverflow.com/questions/2979835/show-milliseconds-with-android-chronometer) what problem do you have with the code in the above link – Abhay Kumar Nov 04 '11 at 10:29
-
1Have you tried System.currentTimeMillis() ? Or does it not serve your purpose? – c05mic Nov 04 '11 at 10:29
-
1I'm testing it and it just not works. FormatTime? I don't have that function! Even if I try to show only "i" it crashes. I don't know what I'm doing wrong =( – ArcDare Nov 04 '11 at 10:48
-
This looks like it might work: http://developer.android.com/resources/articles/timed-ui-updates.html I'll let you know – ArcDare Nov 04 '11 at 10:56
-
1Using System.currentTimeMillis() and playing with it works! Thank you very much! – ArcDare Nov 04 '11 at 11:09
1 Answers
1
Ok, this is the easiest way: When you want to start the chrono:
StartTime=System.currentTimeMillis(); // I've defined StartTime as a double
Then, you just have to do compare current time with StartTime:
millis=System.currentTimeMillis()-StartTime; // Millis is a double too
// If you'd want seconds, add seconds=(int) milis/1000; etc.
And so you can play with milis (Has it arrive to the time I wanted? How many time is it counting? ...)

ArcDare
- 3,106
- 4
- 27
- 38