Chronometer reset

前端 未结 1 1930
清歌不尽
清歌不尽 2021-02-18 23:44

I am trying to completely restart Chronometer and its does not work. Instead it is being paused. Basically what I am trying to do is to do something while chronometer is countin

相关标签:
1条回答
  • 2021-02-19 00:42

    When I played with the chronometer awhile back I just used the setBase() method to set the base to the current time just before calling start(). Depending on your exact needs you may need to add some logic around whether to reset the chronometer or not before starting it.

    View.OnClickListener mStartButtonListener = new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                mChronometer.setBase(SystemClock.elapsedRealtime());
                mChronometer.start();
            }
        };
    
    0 讨论(0)
提交回复
热议问题