Fixed possible nullpointerexception in onPositionObserverUpdate()
This commit is contained in:
parent
258a6acd6e
commit
891f2e09f4
|
@ -317,18 +317,21 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||||
protected abstract void clearStatusMsg();
|
protected abstract void clearStatusMsg();
|
||||||
|
|
||||||
protected void onPositionObserverUpdate() {
|
protected void onPositionObserverUpdate() {
|
||||||
int currentPosition = controller.getPosition();
|
if (controller != null) {
|
||||||
int duration = controller.getDuration();
|
int currentPosition = controller.getPosition();
|
||||||
if (currentPosition != PlaybackService.INVALID_TIME
|
int duration = controller.getDuration();
|
||||||
&& duration != PlaybackService.INVALID_TIME) {
|
if (currentPosition != PlaybackService.INVALID_TIME
|
||||||
controller.getMedia().setPosition(currentPosition);
|
&& duration != PlaybackService.INVALID_TIME
|
||||||
txtvPosition.setText(Converter
|
&& controller.getMedia() != null) {
|
||||||
.getDurationStringLong(currentPosition));
|
controller.getMedia().setPosition(currentPosition);
|
||||||
txtvLength.setText(Converter.getDurationStringLong(duration));
|
txtvPosition.setText(Converter
|
||||||
updateProgressbarPosition(currentPosition, duration);
|
.getDurationStringLong(currentPosition));
|
||||||
} else {
|
txtvLength.setText(Converter.getDurationStringLong(duration));
|
||||||
Log.w(TAG,
|
updateProgressbarPosition(currentPosition, duration);
|
||||||
"Could not react to position observer update because of invalid time");
|
} else {
|
||||||
|
Log.w(TAG,
|
||||||
|
"Could not react to position observer update because of invalid time");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue