Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; public class Main { /** * Computes the navigation bar height comparing the usable screen height and the real display height. * Please note that the system status bar is considered part of the usable screen height. * @param context Android Context instance * @return The height in pixels of the system navigation bar */ public static int getNavigationBarSize(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); //noinspection ConstantConditions Display display = windowManager.getDefaultDisplay(); Point appUsableSize = new Point(); display.getSize(appUsableSize); Point realScreenSize = new Point(); display.getRealSize(realScreenSize); return realScreenSize.y - appUsableSize.y; } }