Java tutorial
//package com.java2s; import android.app.Activity; import android.graphics.Rect; import android.view.Window; public class Main { public static int getStatusBarHeight(Activity context) { Rect rectangle = new Rect(); Window window = context.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectangle); return rectangle.top; } }