Here you can find the source of getStatusHeight(Context context)
public static int getStatusHeight(Context context)
//package com.java2s; import android.content.Context; public class Main { public static int getStatusHeight(Context context) { int statusHeight = -1; try {/*from www. j a v a 2 s . c om*/ Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); int height = Integer.parseInt(clazz .getField("status_bar_height").get(object).toString()); statusHeight = context.getResources().getDimensionPixelSize( height); } catch (Exception e) { e.printStackTrace(); } return statusHeight; } }