안드로이드에서 태블릿인지 폰인지 구분하는 방법


 
static boolean isTablet (Context context) { 
        // TODO: This hacky stuff goes away when we allow users to target devices 
        int xlargeBit = 4; // Configuration.SCREENLAYOUT_SIZE_XLARGE;  // upgrade to HC SDK to get this 
        Configuration config = context.getResources().getConfiguration(); 
        return (config.screenLayout & xlargeBit) == xlargeBit; 
} 


출처 : http://stackoverflow.com/questions/9478793/how-to-know-its-phone-or-tablet



+ Recent posts