Code example for Chronometer

Methods: setBase, start, stop

0
 
    /** 
     * Starts a new game. 
     */ 
    public void startTimerNew() { 
        chronoTimer.stop();
        chronoTimer.setBase(getCurrentTime());
        chronoTimer.start();
        pauseChronoElapsed = 0;
        levelStartTimeLeft = startTime;
 
    } 
 
    public void pauseTimer() { 
        chronoTimer.stop();
        pauseChronoElapsed = getCurrentTime() - chronoTimer.getBase();
    } 
 
    /** 
     * Starts a new level because it is paused during the victory or loss vibration pattern (to preserve time). 
     * Almost the same as resumeTimer() but also sets a new levelStartTimeLeft.