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 activity) { Rect rectgle = new Rect(); Window window = activity.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectgle); int StatusBarHeight = rectgle.top; return StatusBarHeight; } }