Android device is tablet?

If you want to check device type is tablet or not, here is the tricky function that i am using.
public static boolean isTablet(Context context) {
    int xlargeBit = 4; // Configuration.SCREENLAYOUT_SIZE_XLARGE;
    Configuration config = context.getResources().getConfiguration();
    boolean isTablet = (config.screenLayout & xlargeBit) == xlargeBit;
    return isTablet;
}

0 comments:

Post a Comment