Code example for SeekBar

Methods: getMaxsetSecondaryProgress

0
 
	private class MediaHandler implements MediaPlayer.OnBufferingUpdateListener, MediaPlayer.OnCompletionListener, MediaPlayer.OnPreparedListener, MediaPlayer.OnSeekCompleteListener {
 
		@Override 
		public void onBufferingUpdate(MediaPlayer mp, int percent) {
			percent = percent * (mSeekBar.getMax() / 100);
			mSeekBar.setSecondaryProgress(percent);
		} 
 
		@Override 
		public void onCompletion(MediaPlayer mp) {
			// we don't want to lose the wakelock right now because then the 
			// user has to unlock their device again. The wakelock has 
			// ON_AFTER_RELEASE to fix that usability nuisance. 
			setVisibility(View.GONE);
		} 
 
		@Override 
		public void onPrepared(MediaPlayer mp) {
			play(); 
			mSeekBar.setMax(mp.getDuration());