본문 바로가기

프로그래밍/Android

태블릿 확인 하기

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