Search code examples
androidchronometer

How to set the display time in a chronometer


I am using a chronometer as a kind of stop watch.

I want to start it not at 0 but at some other time, for example, 8 seconds, or 10 minutes, etc.

When I try to call setBase, passing in the ms time, it shows non-numeric characters.

What to do??

Thanks!


Solution

  • In general:

    mChronometer.setBase(SystemClock.elapsedRealtime() - (nr_of_min * 60000 + nr_of_sec * 1000)))

    Hopefully this will save lots of u folks some time :)