Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.util.DisplayMetrics;
import android.util.Pair;

import android.view.WindowManager;

public class Main {
    public static Pair<Integer, Integer> getScreenDimensions(Context paramContext) {
        WindowManager localWindowManager = (WindowManager) paramContext.getSystemService("window");
        DisplayMetrics localDisplayMetrics = new DisplayMetrics();
        localWindowManager.getDefaultDisplay().getMetrics(localDisplayMetrics);
        int i = Math.min(localDisplayMetrics.widthPixels, localDisplayMetrics.heightPixels);
        int j = Math.max(localDisplayMetrics.widthPixels, localDisplayMetrics.heightPixels);
        return new Pair(Integer.valueOf(i), Integer.valueOf(j));
    }
}