Code example for ActionBar

Methods: getDisplayOptionssetDisplayOptionssetHomeButtonEnabled

0
        // All the flags we may change in this method. 
        final int MASK = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME
                | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM;
 
        // The current flags set to the action bar.  (only the ones that we may change here) 
        final int current = mActionBar.getDisplayOptions() & MASK;
 
        // Build the new flags... 
        int newFlags = 0;
        newFlags |= ActionBar.DISPLAY_SHOW_TITLE;
        if (mShowHomeIcon) {
            newFlags |= ActionBar.DISPLAY_SHOW_HOME;
        } 
        if (mSearchMode) {
            newFlags |= ActionBar.DISPLAY_SHOW_HOME;
            newFlags |= ActionBar.DISPLAY_HOME_AS_UP;
            newFlags |= ActionBar.DISPLAY_SHOW_CUSTOM;
        } 
        mActionBar.setHomeButtonEnabled(mSearchMode);
 
        if (current != newFlags) {
            // Pass the mask here to preserve other flags that we're not interested here. 
            mActionBar.setDisplayOptions(newFlags, MASK);
        } 
    } 
 
    private void update() { 
        boolean isIconifiedChanging = mSearchView.isIconified() == mSearchMode;
Connect your IDE to all the code out there  Get Codota for Java