Code example for Chronometer

Methods: setText, getBase

0
            }); 
        } 
    } 
     
    private long getChronometerTimeInMillis() { 
        long base = mChronometer.getBase();
        long current = SystemClock.elapsedRealtime();
        return current - base;
    } 
     
    private void setChronometerTime(final long time) {
        long timeInSecs = TimeUnit.MILLISECONDS.toSeconds(time);
        mChronometer.setText(Long.toString(timeInSecs));
    } 
     
    private void openGameEndDialog() { 
        gameEndDialog = new GameFinishedDialog(this, game);
        DialogUtil.showDialog(gameEndDialog);
    } 
     
    @Override