Code example for SeekBar

Methods: getMaxgetProgresssetProgress, getWidth

0
            if (fromUser && mMediaPlayer != null) { 
            	 
            	lastActionTime = SystemClock.elapsedRealtime(); 
            	 
            	// keeps knob visible 
            	int knobPosition = keepKnobVisible(volume.getMax(), volume.getWidth(), 25); 
            	 
            	if (volume.getProgress() < knobPosition) { 
            		 
            		volume.setProgress(knobPosition); 
            		 
        		} else if (volume.getProgress() > (volume.getMax() - knobPosition)) { 
        			 
        			volume.setProgress(volume.getMax() - knobPosition); 
        			 
        		} else { 
        			 
        			volume.setProgress(progress); 
        		} 
            	 
            	mMediaPlayer.setVolume((float)seekBar.getProgress()/100, (float)seekBar.getProgress()/100); 
            } 
        }