Return true if device is at least 720x960 dp, otherwise false. - Android Android OS

Android examples for Android OS:OS Version

Description

Return true if device is at least 720x960 dp, otherwise false.

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.res.Configuration;
import android.support.annotation.NonNull;

public class Main {
    /** Return true if device is at least 720x960 dp, otherwise false. */
    public static boolean isTabletLarge(@NonNull Context context) {
        return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
    }//from w ww  .j  a va 2s .c o m
}

Related Tutorials