Android 获取显示在视图中的计时器值

Android 获取显示在视图中的计时器值,android,time,chronometer,Android,Time,Chronometer,我正在用计时器在我的android应用程序中显示时间 我想得到显示在屏幕上的计时器值。我试着用 int stoppedMilliseconds = 0; String chronoText = chronometer.getText().toString(); String array[] = chronoText.split(":"); if (array.length == 2) { stoppedMilli

我正在用计时器在我的android应用程序中显示时间

我想得到显示在屏幕上的计时器值。我试着用

int stoppedMilliseconds = 0;
          String chronoText = chronometer.getText().toString();
          String array[] = chronoText.split(":");
          if (array.length == 2) {
            stoppedMilliseconds = Integer.parseInt(array[0]) * 60 * 1000
                + Integer.parseInt(array[1]) * 1000;
          } else if (array.length == 3) {
            stoppedMilliseconds = Integer.parseInt(array[0]) * 60 * 60 * 1000 
                + Integer.parseInt(array[1]) * 60 * 1000
                + Integer.parseInt(array[2]) * 1000;
          }
          chronometer.setBase(SystemClock.elapsedRealtime() - stoppedMilliseconds);
为了得到这个值,我使用了
long elapsedMillis=SystemClock.elapsedRealtime()-chronometer.getBase()

它显示了一个特定的数字,对我来说,它看起来不像屏幕上显示的时间。如果屏幕上的计时器显示1秒,我希望得到精确的1秒值,而不是任何随机数

有人能帮我吗