get Window Height - Android Phone

Android examples for Phone:Screen

Description

get Window Height

Demo Code


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

import android.util.DisplayMetrics;

public class Main {
    public static int getWindowHeight(Activity activity) {

        DisplayMetrics dm = new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
        return dm.heightPixels;
    }//  w w  w .  ja v a2 s  .  c  o  m
}

Related Tutorials