views:

119

answers:

1

Hi everyone,

I am writing a simple android application with a class that extends activity, that plays a video from a url on the web. There is a button on top that on click takes the user to a web page.

What I want to do is when the user is browsing the web page, if he hits the back button, I want him to come back to the main activity and restart the video. Is there a way to do this?

Also, is there a way the video can be resumed from where it left off?

Thank you. Chris

A: 

I don't know the details of how the video player works, but my hunch is you have to:

  1. Override onSaveInstanceState to save the place in the video (maybe a timestamp?)

  2. Override onRestoreInstanceState to reload the video and seek to the point saved in step 1

Brandon