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.app.Activity;

import android.util.Pair;

public class Main {
    static final int MIN_REL_WIDTH = 640;
    static final int MIN_REL_HEIGHT = 480;
    static Pair<Integer, Integer> sResolution;

    public static boolean isSuitableResolution(Activity activity) {
        Pair<Integer, Integer> rel = getResolution(activity);
        return (rel.first >= MIN_REL_WIDTH && rel.second >= MIN_REL_HEIGHT);
    }

    public static Pair<Integer, Integer> getResolution(Activity activity) {
        if (null == sResolution) {
            int width = activity.getWindowManager().getDefaultDisplay().getWidth();
            int height = activity.getWindowManager().getDefaultDisplay().getHeight();
            sResolution = new Pair<Integer, Integer>(width, height);
        }
        return sResolution;
    }
}