Skip to content

Instantly share code, notes, and snippets.

@dmitry-zaitsev
Created April 4, 2013 12:20
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 dmitry-zaitsev/5309912 to your computer and use it in GitHub Desktop.
Save dmitry-zaitsev/5309912 to your computer and use it in GitHub Desktop.
How to properly set "alwaysOpen" property for big devices. This snippet causes side menu to be always opened ONLY on big devices ONLY in landscape mode.
Configuration config = getResources().getConfiguration();
boolean alwaysOpen = config.orientation == Configuration.ORIENTATION_LANDSCAPE
&& ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
|| (config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment