Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. Display display = getWindowManager().getDefaultDisplay();
  2. int width = display.getWidth();
  3. int height = display.getHeight();
  4.  
  5. boolean is_tablet = false;
  6. if (width >= min_tab_width && height >= min_tab_height) {
  7. is_tablet = true;
  8. }
  9.  
  10. <manifest ... >
  11. <supports-screens android:requiresSmallestWidthDp="600" />
  12. ...
  13. </manifest>
  14.  
  15. //Determine screen size
  16. if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
  17. Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
  18.  
  19. }
  20. else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
  21. Toast.makeText(this, "Normal sized screen" , Toast.LENGTH_LONG).show();
  22.  
  23. }
  24. else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
  25. Toast.makeText(this, "Small sized screen" , Toast.LENGTH_LONG).show();
  26. }
  27. else {
  28. Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show();
  29. }
Add Comment
Please, Sign In to add comment