Example usage for android.view Window FEATURE_ACTION_BAR

List of usage examples for android.view Window FEATURE_ACTION_BAR

Introduction

In this page you can find the example usage for android.view Window FEATURE_ACTION_BAR.

Prototype

int FEATURE_ACTION_BAR

To view the source code for android.view Window FEATURE_ACTION_BAR.

Click Source Link

Document

Flag for enabling the Action Bar.

Usage

From source file:android.app.Activity.java

/**
 * {@inheritDoc}// w  ww  . j  a va  2 s  . c om
 * 
 * @return The default implementation returns true.
 */
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR) {
        initActionBar();
        if (mActionBar != null) {
            mActionBar.dispatchMenuVisibilityChanged(true);
        } else {
            Log.e(TAG, "Tried to open action bar menu with no action bar");
        }
    }
    return true;
}

From source file:android.app.Activity.java

/**
 * Default implementation of//from   ww  w .  j  a  v a 2  s .c  om
 * {@link android.view.Window.Callback#onPanelClosed(int, Menu)} for
 * activities. This calls through to {@link #onOptionsMenuClosed(Menu)}
 * method for the {@link android.view.Window#FEATURE_OPTIONS_PANEL} panel,
 * so that subclasses of Activity don't need to deal with feature codes.
 * For context menus ({@link Window#FEATURE_CONTEXT_MENU}), the
 * {@link #onContextMenuClosed(Menu)} will be called.
 */
public void onPanelClosed(int featureId, Menu menu) {
    switch (featureId) {
    case Window.FEATURE_OPTIONS_PANEL:
        mFragments.dispatchOptionsMenuClosed(menu);
        onOptionsMenuClosed(menu);
        break;

    case Window.FEATURE_CONTEXT_MENU:
        onContextMenuClosed(menu);
        break;

    case Window.FEATURE_ACTION_BAR:
        initActionBar();
        mActionBar.dispatchMenuVisibilityChanged(false);
        break;
    }
}