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;

public class Main {
    private static int SCREEN_HEIGHT = 0;

    public static int getScreenHeight(Context context) {
        if (SCREEN_HEIGHT == 0) {
            DisplayMetrics dm = new DisplayMetrics();
            dm = context.getResources().getDisplayMetrics();
            SCREEN_HEIGHT = dm.heightPixels;
        }
        return SCREEN_HEIGHT;
    }
}