Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.TypedArray; public class Main { private static int mActionBarHeight = -1; public static int getActionBarHeight(Context context) { if (mActionBarHeight != -1) { return mActionBarHeight; } TypedArray typedArray = context.obtainStyledAttributes(new int[] { android.R.attr.actionBarSize }); mActionBarHeight = (int) typedArray.getDimension(0, 0); typedArray.recycle(); return mActionBarHeight; } }