Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**
     * Returns true if the device runs Honeycomb or greater and has a LARGE or
     * XLARGE screen size.
     */
    public static boolean isHoneycombTablet(Context ctx) {
        return hasHoneycomb() && isTablet(ctx);
    }

    /**
     * February 22, 2011: Android 3.0 (API 11)
     */
    public static boolean hasHoneycomb() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
    }

    /**
     * Returns true if the device has a LARGE or XLARGE screen size.
     */
    public static boolean isTablet(Context ctx) {
        int screenLayout = ctx.getResources().getConfiguration().screenLayout;
        return Configuration.SCREENLAYOUT_SIZE_LARGE <= (screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);
    }
}