Code example for ProgressBar

Methods: setMax

0
         
        // 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'"); 
        } 
         
        // Stop Chronometer if we're past duration 
        long now = SystemClock.elapsedRealtime();