is Tablet Device - Android Hardware

Android examples for Hardware:Device Feature

Description

is Tablet Device

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.res.Configuration;

public class Main {

    public static boolean isTabletDevice(Context context) {

        if (android.os.Build.VERSION.SDK_INT >= 11) {

            Configuration con = context.getResources().getConfiguration();

            try {
                boolean b = con
                        .isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE);
                return b;
            } catch (Exception e) {
                e.printStackTrace();//from   w  ww.  jav  a2s  .  c o  m
                return false;
            }
        }
        return false;
    }
}

Related Tutorials