Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; import android.content.Context; public class Main { /** * Returns status bar height; * * @param context * @return */ public static int getStatusBarHeight(Context context) { int height = 0; try { Class<?> c = Class.forName("com.android.internal.R$dimen"); Object obj = c.newInstance(); Field field = c.getField("status_bar_height"); int temp = Integer.parseInt(field.get(obj).toString()); height = context.getResources().getDimensionPixelSize(temp); } catch (Exception e) { e.printStackTrace(); } return height; } }