Skip to content

Instantly share code, notes, and snippets.

@mezhevikin
Created January 3, 2023 09:04
Show Gist options
  • Save mezhevikin/b0486bfd518f64770f739b3914aedc52 to your computer and use it in GitHub Desktop.
Save mezhevikin/b0486bfd518f64770f739b3914aedc52 to your computer and use it in GitHub Desktop.
Detect android tablet
val Context.isTablet: Boolean get() {
val layout = resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
return layout == Configuration.SCREENLAYOUT_SIZE_LARGE || layout == Configuration.SCREENLAYOUT_SIZE_XLARGE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment