Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;

import android.view.Display;

public class Main {
    private static int sDevicesScreenWidth;
    private static int sDevicesScreenHeight;

    public static void initParamsWithDisplay(Activity activity) {
        sDevicesScreenHeight = getDisplayHeight(activity);
        sDevicesScreenWidth = getDisplayWidth(activity);
    }

    private static int getDisplayHeight(Activity activity) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        return display.getHeight();
    }

    private static int getDisplayWidth(Activity activity) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        return display.getWidth();
    }
}