Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; public class Main { /** * Get status bar height * @param context * @return */ public static int getStatusBarHeight(Context context) { int statusBarHeight = 0; Resources resource = context.getResources(); int resourceId = resource.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { statusBarHeight = resource.getDimensionPixelSize(resourceId); } return statusBarHeight; } }