get Window Height - Android android.app

Android examples for android.app:Window

Description

get Window Height

Demo Code

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;

public class Main{


    public static int getWindowHeight(Context context) {
        DisplayMetrics dm = new DisplayMetrics();
        ((Activity) context).getWindowManager().getDefaultDisplay()
                .getMetrics(dm);/*from   w  w  w .ja v  a 2 s .c  om*/
        return dm.heightPixels;
    }

}

Related Tutorials