How to lock screen orientation when anctivity isn't recreated

I have an activity used to display a video (VideoView). By default the user can change screen orientation to see the video. I avoid destroying/recreating the activity upon orientation changes because of latency issue. The rotation is painless without any sound break.

android:configChanges="keyboardHidden|orientation|screenSize"

What I want to do now is add a button that will force the activity to remain on current orientation.

The problem is that because the activity isn't recreated after the rotation, I don't know which method to override to avoid the rotation to happen. Overriding onConfigurationChanged is useless because the rotation already happened.

UsesetRequestedOrientation().

E.g. to lock the orientation to portrait, call:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

In your activity.