Friday, 23 August 2013

onStopTrackingTouch() is not woking

onStopTrackingTouch() is not woking

In this my seekbar is not working. it is not stopping on a particular
position. It will automatically come to the previous condition. Please
help me. Thank you.
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mHandler.removeCallbacks(mUpdateTimeTask);
int totalDuration = mp.getDuration();
int currentPosition = utils.progressToTimer(seekbar.getProgress(),
totalDuration);
// forward or backward to certain seconds
strong text mp.seekTo(currentPosition);
// update timer progress again
updateProgressBar();
}
public void updateProgressBar() {
mHandler.postDelayed(mUpdateTimeTask, 100);
}
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
long totalDuration = mp.getDuration();
long currentDuration = mp.getCurrentPosition();
// Displaying Total Duration time
completetime.setText(""+utils.milliSecondsToTimer(totalDuration));
// Displaying time completed playing
startindex.setText(""+utils.milliSecondsToTimer(currentDuration));
// Updating progress bar
int progress =
(int)(utils.getProgressPercentage(currentDuration,
totalDuration));
//Log.d("Progress", ""+progress);
seekbar.setProgress(progress);
// Running this thread after 100 milliseconds
mHandler.postDelayed(this, 100);
}
};

No comments:

Post a Comment