Code example for SeekBar

Methods: getMaxsetProgress, getWidth

0
    	if (mMediaPlayer != null) {
    		 
    		// updates current position 
    		curPosition = mMediaPlayer.getCurrentPosition();
			 
    		int knobPosition = keepKnobVisible(timeline.getMax(), timeline.getWidth(), 26);
    		 
    		// updates the progress bar keeping the knob in view 
    		if (curPosition < knobPosition) {
    			 
    			timeline.setProgress(knobPosition);
    			 
    		} else if (curPosition > (timeline.getMax() - knobPosition)) {
    			 
    			timeline.setProgress(timeline.getMax() - knobPosition);
    			 
    		} else { 
    			 
    			timeline.setProgress(curPosition);
    		} 
    		 
	    	//updates the timers 
	    	timers(curPosition);