Code example for Chronometer

Methods: getBase

0
        if (mProgressBar == null || mChronometer == null) {
            throw new RuntimeException("Expecting child ProgressBar with id " +
                    "'android.R.id.progress' and Chronometer id 'android.R.id.text1'"); 
        } 
         
        // Update the ProgressBar maximum relative to Chronometer base 
        mDuration = (int) (durationBase - mChronometer.getBase());
        if (mDuration <= 0) {
            mDuration = 1;
        } 
        mProgressBar.setMax(mDuration);
    } 
     
    /** 
     * Callback when {@link Chronometer} changes, indicating that we should 
     * update the {@link ProgressBar} and change the layout if necessary. 
     */ 
    public void onChronometerTick(Chronometer chronometer) {
        if (mProgressBar == null) {
            throw new RuntimeException(
                "Expecting child ProgressBar with id 'android.R.id.progress'");