I have a VideoView
in which I want to play video after buffering complete.
I have managed two different xml code layouts for landscape and portrait each.
My issue is that when I change orientation of device, the video buffering restart again.
I have a VideoView
in which I want to play video after buffering complete.
I have managed two different xml code layouts for landscape and portrait each.
My issue is that when I change orientation of device, the video buffering restart again.
Try putting
android:configChanges="screenOrientation" in the activity tag of your Manifest file.
This way the activity will not be recreated.
I think this will help you.
actually you have to do a couple of things firstly handle the orientation yourself to do this you have to add this under the activity
android:configChanges="keyboardHidden|orientation|screenSize"
now override onConfigurationChanged inside your activity.java file
After this it depends on your layout if there is anything under the videoview then hide it and change the layout params of the videoview like this,
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
//your logic for landscape
} else {
//your logic for potrait
}
}
Ps:things might not go very smoothly during orientation change in videoview, refer this answer also it might be helpful Android VideoView orientation change with buffered video