1
votes

I have a VideoView taking up the whole screen when in Landscape. I want to be able to constrain the video to the top half of the screen when in portrait so I can show additional controls/info below it.

I'm using "configChanges=orientation" in the manifest to prevent the videoview from restarting when the orientation changes. However this means the different orientation layouts are ignored and only the first one encountered used.

Does anyone have any idea how I would go about keeping the video playing between changes from Portrait to Landscape and back while in Portrait displaying additional UI components below the video?

Thanks!

1

1 Answers

0
votes

You can maintain your data playing in videoview from restarting when orientation takes place:

  1. Override the onRetainNonConfigurationInstance() method to return the object you would like to retain.

  2. When your activity is created again, call getLastNonConfigurationInstance() to recover your object.

you can also refer this doc:

http://developer.android.com/guide/topics/resources/runtime-changes.html