has On Screen System Bar - Android User Interface

Android examples for User Interface:Window

Description

has On Screen System Bar

Demo Code


//package com.java2s;

import java.lang.reflect.Method;

import android.content.Context;

import android.graphics.Point;

import android.view.Display;

import android.view.WindowManager;

public class Main {
    private static Context context;

    public static boolean hasOnScreenSystemBar() {
        WindowManager wm = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
        Display d = wm.getDefaultDisplay();
        int deviceDisplayHeight = 0;
        try {/*from   www.j a  v a  2s  .  c  o m*/
            Method getRawHeight = Display.class.getMethod("getRawHeight");
            deviceDisplayHeight = (Integer) getRawHeight.invoke(d);
        } catch (Exception ex) {

        }

        Point s = new Point();
        d.getSize(s);
        int windowHeight = s.y;

        return deviceDisplayHeight - windowHeight > 0;
    }
}

Related Tutorials