Figure out whether status bar is at top or bottom?
<p>I am trying to figure out how I can tell the location of the status bar (top or bottom). I tried to inspect <code>HierarchyViewer</code> but didn't see the status bar view.</p>

<p>Really what I need to figure out is, given a context, a way to return a <code>boolean</code> (true if bar is on top, false if it isn't -- like it isn't on <em><strong>most</strong></em> tablets). I wrote a simple solution to try and figure out of the status bar is at the top or bottom, but it doesn't seem to be helping:</p>

<pre><code>private boolean isStatusBarAtTop(){
    if (!(getContext() instanceof Activity)) {
        return !getContext().getResources().getBoolean(R.bool.isTablet);
    }

    Window window =  ((Activity) getContext()).getWindow();

    if(window == null) {
        return !getContext().getResources().getBoolean(R.bool.isTablet);
    }

    Activity activity = (Activity)getContext();
    Rect rect = new Rect();

    window.getDecorView().getWindowVisibleDisplayFrame(rect);
    View ourView = window.findViewById(Window.ID_ANDROID_CONTENT);

    Log.d("Menu","Window Top: "+ ourView.getTop() + ", "+ourView.getBottom()+ ", "+ourView.getLeft()+", "+ourView.getRight());
    Log.d("Menu","Decor View Dimensions"+rect.flattenToString());

    return  ourView.getTop() != 0;
}
</code></pre>

<p>And for some reason I get the following as output (running on Nexus 7 Tablet):</p>

<pre><code>D/Menu(1007): Window Top: 0, 0, 0, 0
D/Menu(1007): Decor View Dimensions0 0 800 1216
</code></pre>

<p>What am I thinking/doing wrong?</p>
