Android Tablet Check isTablet(Context context)

Here you can find the source of isTablet(Context context)

Description

public static boolean isTablet(Context context){ this method will return true if device is tab else it will return false

License

Apache License

Parameter

Parameter Description
context a parameter

Declaration

public static boolean isTablet(Context context) 

Method Source Code

//package com.java2s;
/*/*w  ww.  j  a  v a  2s .  c om*/
 * Copyright 2013 Nagendra K Srivastava.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    /**
     * <b><i>public static boolean isTablet(Context context){</b></i>
     * this method will return true if device is tab else it will return false
     * @param context
     * @return {@link bool}
     * 
     */
    public static boolean isTablet(Context context) {
        TelephonyManager _manager = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        if (_manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. isTablet(Configuration configuration)
  2. isTabletDevice(Display d, Activity context)
  3. isTabletDevice(Context activityContext)