zoukankan      html  css  js  c++  java
  • Android判断用户是平板还是手机的方法

    public boolean isTabletDevice() {
            TelephonyManager telephony = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
            int type = telephony.getPhoneType();
            if (type == TelephonyManager.PHONE_TYPE_NONE) {
                Log.i("is Tablet!");
            } else {
                Log.i("is phone!");
            }
            return false;
        }

    http://www.cnblogs.com/coding-way/archive/2012/04/23/2466412.html

    /**
         * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
         * @param context
         * @return 平板返回 True,手机返回 False
         */
        public static boolean isTablet(Context context) {
            return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
        }

    http://www.cnblogs.com/sunzn/p/3663363.html

  • 相关阅读:
    static用法
    Spring相关配置及工厂模式
    Mybatis的相关配置及理解
    jsp内置对象简介
    JAVA基础——接口的理解
    JAVA基础——抽象类以及final修饰符总结
    关于JAVA基础 ——继承的总结
    封装
    static的用法
    构造方法的重载
  • 原文地址:https://www.cnblogs.com/jiduoduo/p/5170924.html
Copyright © 2011-2022 走看看