Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.DisplayMetrics;
import android.view.WindowManager;

public class Main {
    private static Integer screenHeight;

    public static int getScreenHeight(WindowManager windowManager) {
        if (screenHeight == null) {
            DisplayMetrics dm = new DisplayMetrics();
            windowManager.getDefaultDisplay().getMetrics(dm);
            screenHeight = dm.heightPixels;
        }
        return screenHeight;
    }
}