is Pad tablet by checking model number - Android Android OS

Android examples for Android OS:System Model

Description

is Pad tablet by checking model number

Demo Code


//package com.java2s;

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

public class Main {
    public static boolean isPad(Context applicationContext) {
        boolean isPad = false;
        String model = Build.MODEL;
        if (model.contains("N7000") || model.contains("I9200")
                || model.contains("C6802") || model.contains("C6833")) {
            return false;
        }//  w w  w  .  j  av  a  2 s .  c o m
        Configuration config = applicationContext.getResources()
                .getConfiguration();
        if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
            isPad = false;
        } else if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
            isPad = false;
        } else if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4) {
            isPad = true;
        } else {
            isPad = true;
        }
        return isPad;
    }
}

Related Tutorials