Code example for SeekBar

Methods: getMaxgetProgresssetProgress

0
        } 
 
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO - should we animate this movement? 
            int sector = (int) (unitProgress(seekBar) * 3); // 0 ,1 ,2
            int progress = (sector * seekBar.getMax()) / 2;
            seekBar.setProgress(progress);
        } 
 
        public void onStartTrackingTouch(SeekBar seekBar) {
        } 
 
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            boolean before = progress == 0, after = seekBar.getMax() == progress, middle = seekBar.getMax() / 2 ==
                    progress;
            if (before || after || middle) {
                vibrator.vibrate(17);
            } 
            // sadly makes the damn seekbar wiggle 
//            beforeTextView.setTypeface(before?boldTypeFace:defaultTypeface); 
//            afterTextView.setTypeface(after?boldTypeFace:defaultTypeface); 
            float unitProgress = unitProgress(seekBar);
 
            notifyTheOthers(unitProgress);
 
        } 
 
 
        private float unitProgress(SeekBar seekBar) {
            return ((float) seekBar.getProgress()) / seekBar.getMax();
        } 
    } 
 
    private void notifyTheOthers(float unitProgress) {
        Log.d(TAG, "notifyTheOthers stateUpdateListener=" + stateUpdateListener);