Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.res.Configuration;

public class Main {
    private static String UNKNOWN = "";

    /**
     * Constant for screenLayout: bits that encode the size.
     * @param sl_size_mask "screenLayout & SCREENLAYOUT_SIZE_MASK"
     * @return Device type by screen size, "Handset" or "Tablet".
     */
    public static String getDeviceTypeStr(int sl_size_mask) {
        switch (sl_size_mask) {
        case Configuration.SCREENLAYOUT_SIZE_SMALL://1
        case Configuration.SCREENLAYOUT_SIZE_NORMAL://2
            return "Handset";
        case Configuration.SCREENLAYOUT_SIZE_LARGE://3
        case Configuration.SCREENLAYOUT_SIZE_XLARGE://4
            return "Tablet";
        default:
            return UNKNOWN;
        }
    }
}