Fixed crash when moving progressbar

This commit is contained in:
daniel oeh 2012-07-26 20:22:10 +02:00
parent fab2110715
commit 58ec618276
1 changed files with 5 additions and 3 deletions

View File

@ -387,7 +387,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
if (fromUser) {
if (fromUser && PlaybackService.isRunning) {
prog = progress / ((float) seekBar.getMax());
duration = playbackService.getPlayer().getDuration();
txtvPosition.setText(Converter
@ -407,8 +407,10 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
playbackService.seek((int) (prog * duration));
setupPositionObserver();
if (PlaybackService.isRunning) {
playbackService.seek((int) (prog * duration));
setupPositionObserver();
}
}
});