I have a VideoView and it is pause when I start an Email intent. When the email intent is done, I want the videoView to continue playing, however, it restarts from the beginning.
@Override
public void onPause() {
Log.d(TAG, "onPause called");
super.onPause();
videoView.pause();
}
@Override
public void onResume() {
super.onResume();
Log.d(TAG, "onResume called");
videoView.start();//resume() doesnt work
}
How can I get the videoView to resume from where it left off.
What about this:
@Override
public void onResume() {
super.onResume();
Log.d(TAG, "onResume called");
videoView.seekTo(stopPosition);
videoView.start(); //Or use resume() if it doesn't work. I'm not sure
}
// This gets called before onPause so pause video here.
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
stopPosition = videoView.getCurrentPosition();
videoView.pause();
outState.putInt("position", stopPosition);
}
Then in your onCreate() call the stopPosition from the bundle and set it globally
@Override
protected void onCreate(Bundle args) {
super.onCreate(args);
if( args != null ) {
stopPosition = args.getInt("position");
}