I\'m looking for a way to make the Chronometer in Android (preferably 1.6 and upwards) show 10ths of a second while counting up.
Is it possible to do this? If not, i
I have found the way after lots and lots of research. I don't know if it's effective or not, because the truth is that the Emulator crashes after about 10 seconds, but on the phone it runs just fine, and that does it for me. It looks something like this:
import android.os.Handler;
public class Chronometer extends Activity {
private Handler mHandler = new Handler();
public void actions() {
mHandler.removeCallbacks(mUpdateTimeTask);
mHandler.postDelayed(mUpdateTimeTask, 1); //1 is the number of milliseconds you want the text to be updated
}
Runnable mUpdateTimeTask = new Runnable() {
public void run() {
i++;
txt.setText(formatTime(i)); // formatTime is just for make it readable in HH:MM:SS:MS, but I assume you already have this
mHandler.postDelayed(this, 1);
}
};
}