This repository was archived by the owner on Jun 22, 2023. It is now read-only.

Description
Describe the problem
The example says to save current position like this:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(PLAYBACK_TIME, mVideoView.getCurrentPosition());
}
but onSaveInstanceState call comes after onPause, so mVideoView.getCurrentPosition() is 0.
I think it will be better:
@Override
protected void onPause() {
super.onPause();
currentPosition = videoView.getCurrentPosition();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
videoView.pause();
}
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(PLAYBACK_TIME, currentPosition);
}
In which lesson and step of the codelab can this issue be found?
Lesson number + step number. (e.g., Lesson 13.1, Step 1.5)
Versions
Android Studio Dolphin | 2021.3.1 Patch 1
problem found on API 28
codelab: advanced-android