4

I have a chronometer and am using mChronometer.getText();how do I convert this to an int? using Integer.parseInt(); throws an error because mChronometer.getText(); outputs in the form minutes : seconds

Aryan
  • 136
  • 1
  • 3
  • 17

1 Answers1

11

if you are using android.widget.Chronometer you can get the elapsed time with :

int elapsedMillis = (int) (SystemClock.elapsedRealtime() - mChronometer.getBase());
Ahmed Abidi
  • 1,047
  • 12
  • 24
  • where would i put this in my code? after mChronometer.start of before – Aryan Dec 30 '16 at 14:22
  • refer to this post for more informations how to implement `android.widget.Chronometer` : http://stackoverflow.com/questions/526524/android-get-time-of-chronometer-widget – Ahmed Abidi Dec 30 '16 at 14:24