Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Display display = getWindowManager().getDefaultDisplay();
- int width = display.getWidth();
- int height = display.getHeight();
- boolean is_tablet = false;
- if (width >= min_tab_width && height >= min_tab_height) {
- is_tablet = true;
- }
- <manifest ... >
- <supports-screens android:requiresSmallestWidthDp="600" />
- ...
- </manifest>
- //Determine screen size
- if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
- Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
- }
- else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
- Toast.makeText(this, "Normal sized screen" , Toast.LENGTH_LONG).show();
- }
- else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
- Toast.makeText(this, "Small sized screen" , Toast.LENGTH_LONG).show();
- }
- else {
- Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show();
- }
Add Comment
Please, Sign In to add comment