Java tutorial
//package com.java2s; import android.content.Context; import java.lang.reflect.Field; public class Main { @SuppressWarnings("rawtypes") public static int getStatusBarHeigh(Context context) { int heigh = 0; try { Class c = Class.forName("com.android.internal.R$dimen"); Object obj = c.newInstance(); Field field = c.getField("status_bar_height"); int x = Integer.parseInt(field.get(obj).toString()); heigh = context.getResources().getDimensionPixelSize(x); } catch (Exception e) { e.printStackTrace(); } return heigh; } }