Skip to content

Instantly share code, notes, and snippets.

@jonfhancock
Created December 22, 2016 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonfhancock/2aa60fa6623d390515fb67e0ebf4e312 to your computer and use it in GitHub Desktop.
Save jonfhancock/2aa60fa6623d390515fb67e0ebf4e312 to your computer and use it in GitHub Desktop.
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
lastOrientationRequested = Configuration.ORIENTATION_PORTRAIT;
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);
lastOrientationRequested = Configuration.ORIENTATION_LANDSCAPE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment