Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Method;

import android.graphics.Point;
import android.view.Display;

public class Main {
    static Point getDisplaySizeLT11(Display d) {
        try {
            Method getWidth = Display.class.getMethod("getWidth", new Class[] {});
            Method getHeight = Display.class.getMethod("getHeight", new Class[] {});
            return new Point(((Integer) getWidth.invoke(d, (Object[]) null)).intValue(),
                    ((Integer) getHeight.invoke(d, (Object[]) null)).intValue());
        } catch (Exception ex) { // None of these exceptions should ever occur.
            return new Point(-1, -1);
        }
    }
}