Вы можете попробовать с образцом ниже ...
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
// You can set the value initially by
// ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED. Once set it
// retains it's value. The View will be rendered in the specified
// orientation using the code below.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}