Java tutorial
//package com.java2s; import android.app.Activity; import android.graphics.Rect; public class Main { public static int getStatusBarHeight(Activity activity) { Rect frame = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; return statusBarHeight; } }